#define TIME_UTC /* implementation-defined */
(2) (since C++17) 1)Modifies the
std::timespecobject pointed to by
tsto hold the current calendar time in the time base
base.
2) Expands to a value suitable for use as the base argument of std::timespec_get
.
Other macro constants beginning with TIME_
may be provided by the implementation to indicate additional time bases.
If base is TIME_UTC
, then
TIME_UTC
or another nonzero integer value indicating the time base [edit] Return value
The value of base if successful, zero otherwise.
[edit] NotesThe POSIX function clock_gettime(CLOCK_REALTIME, ts)
may also be used to populate a std::timespec
with the time since the Epoch.
#include <ctime> #include <iostream> int main() { std::timespec ts; std::timespec_get(&ts, TIME_UTC); char buf[100]; std::strftime(buf, sizeof buf, "%D %T", std::gmtime(&ts.tv_sec)); std::cout << "Current time: " << buf << '.' << ts.tv_nsec << " UTC\n"; }
Possible output:
Current time: 06/24/16 20:07:42.949494132 UTC[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4