1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
28 Read access to the system clock with formatting.
33 \*---------------------------------------------------------------------------*/
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class clock Declaration
49 \*---------------------------------------------------------------------------*/
55 //- Start time in seconds
58 //- Time when clockTimeIncrement() was last called
59 mutable time_t lastTime_;
61 //- Latest time from either elapsedClockTime() or clockTimeIncrement()
62 mutable time_t newTime_;
64 //- Names of the months
65 static const char *monthNames[];
72 //- Null constructor which stores the start time
78 //- Get the current clock time in seconds
79 static time_t getTime();
81 //- Return the current wall-clock date as a raw struct
82 static const struct tm rawDate();
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();
88 //- Return the current wall-clock date as a string
91 //- Return the current wall-clock time as a string
92 static string clockTime();
94 //- Returns wall-clock time from clock instantiation
95 time_t elapsedClockTime() const;
97 //- Returns wall-clock time from last call of clockTimeIncrement()
98 time_t clockTimeIncrement() const;
102 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 } // End namespace Foam
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110 // ************************************************************************* //