MeshKit  1.0
clock.cpp
Go to the documentation of this file.
00001 /*********************************************
00002 Reactor Geometry Generator
00003 Argonne National Laboratory
00004 
00005 CClock class definition.
00006 *********************************************/
00007 #include "meshkit/clock.hpp"
00008 
00009 CClock::CClock ()
00010 // ---------------------------------------------------------------------------
00011 // Function: ctor. marks the current time
00012 // Input:    none
00013 // Output:   none
00014 // ---------------------------------------------------------------------------
00015 {
00016   time (&m_Time); 
00017 }
00018 
00019 CClock::CClock (const CClock& Time)
00020 // ---------------------------------------------------------------------------
00021 // Function: copy constructor
00022 // Input:    none
00023 // Output:   none
00024 // ---------------------------------------------------------------------------
00025 {
00026   m_Time = Time.m_Time;
00027 }
00028 
00029 CClock::~CClock()
00030 // ---------------------------------------------------------------------------
00031 // Function: destructor
00032 // Input:    none
00033 // Output:   none
00034 // ---------------------------------------------------------------------------
00035 {
00036 }
00037 
00038 double CClock::DiffTime (const CClock& Time) const
00039 // ---------------------------------------------------------------------------
00040 // Function: computes difference in time (in seconds) between
00041 //           two time instances
00042 // Input:    one of the time instances
00043 // Output:   none
00044 // ---------------------------------------------------------------------------
00045 {
00046   return (difftime (Time.m_Time, m_Time));
00047 }
00048 
00049 double CClock::DiffTime () const
00050 // ---------------------------------------------------------------------------
00051 // Function: computes difference in time (in seconds) between
00052 //           current time and marked time
00053 // Input:    none
00054 // Output:   none
00055 // ---------------------------------------------------------------------------
00056 {
00057   time_t CurTime;
00058   time (&CurTime);
00059   return (difftime (CurTime, m_Time));
00060 }
00061 
00062     
00063 void CClock::MarkTime ()
00064 // ---------------------------------------------------------------------------
00065 // Function: marks the current time
00066 // Input:    none
00067 // Output:   none
00068 // ---------------------------------------------------------------------------
00069 {
00070   time (&m_Time); 
00071 }
00072 
00073 long CClock::GetMarkedTime () const
00074 // ---------------------------------------------------------------------------
00075 // Function: gets the marked time
00076 // Input:    none
00077 // Output:   none
00078 // ---------------------------------------------------------------------------
00079 {
00080   return static_cast<long>(m_Time); 
00081 }
00082 
00083 void CClock::GetDateTime (std::string& szDateTime) const
00084 // ---------------------------------------------------------------------------
00085 // Function: returns as a string the current date and time
00086 // Input:    string to hold current date and time
00087 // Output:   string containing the current date and time
00088 // ---------------------------------------------------------------------------
00089 {
00090   time_t rawtime;
00091   struct tm *timeinfo;
00092 
00093   time (&rawtime);
00094   timeinfo = localtime (&rawtime);
00095   szDateTime = asctime (timeinfo);
00096 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines