34 const char *Foam::clock::monthNames[] =
36 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
37 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
45 return ::time(
reinterpret_cast<time_t*
>(0));
52 struct tm *timeStruct = localtime(&t);
59 std::ostringstream osBuffer;
62 struct tm *timeStruct = localtime(&t);
66 <<
std::setw(4) << timeStruct->tm_year + 1900
67 <<
'-' <<
std::setw(2) << timeStruct->tm_mon + 1
68 <<
'-' <<
std::setw(2) << timeStruct->tm_mday
71 <<
':' <<
std::setw(2) << timeStruct->tm_min
72 <<
':' <<
std::setw(2) << timeStruct->tm_sec;
74 return osBuffer.str();
79 std::ostringstream osBuffer;
82 struct tm *timeStruct = localtime(&t);
85 << monthNames[timeStruct->tm_mon]
86 <<
' ' <<
std::setw(2) << std::setfill(
'0') << timeStruct->tm_mday
87 <<
' ' <<
std::setw(4) << timeStruct->tm_year + 1900;
89 return osBuffer.str();
95 std::ostringstream osBuffer;
98 struct tm *timeStruct = localtime(&t);
103 <<
':' <<
std::setw(2) << timeStruct->tm_min
104 <<
':' <<
std::setw(2) << timeStruct->tm_sec;
106 return osBuffer.str();
114 startTime_(getTime()),
115 lastTime_(startTime_),
124 newTime_ = getTime();
125 return newTime_ - startTime_;
131 lastTime_ = newTime_;
132 newTime_ = getTime();
133 return newTime_ - lastTime_;
time_t elapsedClockTime() const
Returns wall-clock time from clock instantiation.
static time_t getTime()
Get the current clock time in seconds.
static string dateTime()
Return the current wall-clock date/time as a string.
static string clockTime()
Return the current wall-clock time as a string.
static string date()
Return the current wall-clock date as a string.
static const struct tm rawDate()
Return the current wall-clock date as a raw struct.
time_t clockTimeIncrement() const
Returns wall-clock time from last call of clockTimeIncrement()
clock()
Null constructor which stores the start time.
A class for handling character strings derived from std::string.
Omanip< int > setw(const int i)