Files
cppdraft_translate/cppdraft/ctime/syn.md
2025-10-25 03:02:53 +03:00

2.1 KiB

[ctime.syn]

30 Time library [time]

30.15 Header synopsis [ctime.syn]

🔗

#define STDC_VERSION_TIME_H 202311L#define NULL see [support.types.nullptr]#define CLOCKS_PER_SEC see below#define TIME_UTC see below#define TIME_MONOTONIC see below // optional#define TIME_ACTIVE see below // optional#define TIME_THREAD_ACTIVE see below // optionalnamespace std {using size_t = see [support.types.layout]; using clock_t = see below; using time_t = see below; struct timespec; struct tm;

clock_t clock(); double difftime(time_t time1, time_t time0); time_t mktime(tm* timeptr); time_t timegm(tm* timeptr); time_t time(time_t* timer); int timespec_get(timespec* ts, int base); int timespec_getres(timespec* ts, int base); tm* gmtime(const time_t* timer); tm* gmtime_r(const time_t* timer, tm* buf); tm* localtime(const time_t* timer); tm* localtime_r(const time_t* timer, tm* buf); size_t strftime(char* s, size_t maxsize, const char* format, const tm* timeptr);}

1

#

The contents of the header are the same as the C standard library header <time.h>.254

2

#

The functions gmtime andlocaltime are not required to avoid data races ([res.on.data.races]).

See also: ISO/IEC 9899:2024, 7.29

254)254)

strftime supports the C conversion specifiersC, D, e, F, g, G, h,r, R, t, T, u, V, andz, and the modifiers E and O.