| 49 | \*---------------------------------------------------------------------------*/ |
| 50 | |
| 51 | class clock |
| 52 | { |
| 53 | // Private data |
| 54 | |
| 55 | //- Start time in seconds |
| 56 | time_t startTime_; |
| 57 | |
| 58 | //- Time when clockTimeIncrement() was last called |
| 59 | mutable time_t lastTime_; |
| 60 | |
| 61 | //- Latest time from either elapsedClockTime() or clockTimeIncrement() |
| 62 | mutable time_t newTime_; |
| 63 | |
| 64 | //- Names of the months |
| 65 | static const char *monthNames[]; |
| 66 | |
| 67 | |
| 68 | public: |
| 69 | |
| 70 | // Constructors |
| 71 | |
| 72 | //- Null constructor which stores the start time |
| 73 | clock(); |
| 74 | |
| 75 | |
| 76 | // Member Functions |
| 77 | |
| 78 | //- Get the current clock time in seconds |
| 79 | static time_t getTime(); |
| 80 | |
| 81 | //- Return the current wall-clock date as a raw struct |
| 82 | static const struct tm rawDate(); |
| 83 | |
| 84 | //- Return the current wall-clock date/time as a string |
| 85 | // format according to ISO-8601 (yyyy-mm-ddThh:mm:ss) |
| 86 | static string dateTime(); |
| 87 | |
| 88 | //- Return the current wall-clock date as a string |
| 89 | static string date(); |
| 90 | |
| 91 | //- Return the current wall-clock time as a string |
| 92 | static string clockTime(); |
| 93 | |
| 94 | //- Returns wall-clock time from clock instantiation |
| 95 | time_t elapsedClockTime() const; |
| 96 | |
| 97 | //- Returns wall-clock time from last call of clockTimeIncrement() |
| 98 | time_t clockTimeIncrement() const; |
| 99 | }; |
| 100 | |
| 101 | |
| 102 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |