1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Read access to the system clock with formatting.
34 \*---------------------------------------------------------------------------*/
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class clock Declaration
50 \*---------------------------------------------------------------------------*/
56 //- Start time in seconds
59 //- Time when clockTimeIncrement() was last called
60 mutable time_t lastTime_;
62 //- Latest time from either elapsedClockTime() or clockTimeIncrement()
63 mutable time_t newTime_;
65 //- Names of the months
66 static const char *monthNames[];
73 //- Null constructor which stores the start time
79 //- Get the current clock time in seconds
80 static time_t getTime();
82 //- Return the current wall-clock date as a raw struct
83 static const struct tm rawDate();
85 //- Return the current wall-clock date/time as a string
86 // format according to ISO-8601 (yyyy-mm-ddThh:mm:ss)
87 static string dateTime();
89 //- Return the current wall-clock date as a string
92 //- Return the current wall-clock time as a string
93 static string clockTime();
95 //- Returns wall-clock time from clock instantiation
96 time_t elapsedClockTime() const;
98 //- Returns wall-clock time from last call of clockTimeIncrement()
99 time_t clockTimeIncrement() const;
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 } // End namespace Foam
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 // ************************************************************************* //