From 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 Aug 2025 22:58:58 -0500 Subject: removing all downloaded devdocs files --- devdocs/c/chrono%2Fgmtime.html | 71 ------------------------------------------ 1 file changed, 71 deletions(-) delete mode 100644 devdocs/c/chrono%2Fgmtime.html (limited to 'devdocs/c/chrono%2Fgmtime.html') diff --git a/devdocs/c/chrono%2Fgmtime.html b/devdocs/c/chrono%2Fgmtime.html deleted file mode 100644 index 7aaae09c..00000000 --- a/devdocs/c/chrono%2Fgmtime.html +++ /dev/null @@ -1,71 +0,0 @@ -

gmtime, gmtime_r, gmtime_s

Defined in header <time.h>
struct tm *gmtime  ( const time_t *timer );
-
(1)
struct tm *gmtime_r( const time_t *timer, struct tm *buf );
-
(2) (since C23)
struct tm *gmtime_s( const time_t *restrict timer, struct tm *restrict buf );
-
(3) (since C11)
-1) Converts given time since epoch (a time_t value pointed to by timer) into calendar time, expressed in Coordinated Universal Time (UTC) in the struct tm format. The result is stored in static storage and a pointer to that static storage is returned.
-2) Same as (1), except that the function uses user-provided storage buf for the result.
-3) Same as (1), except that the function uses user-provided storage buf for the result and that the following errors are detected at runtime and call the currently installed constraint handler function:
-
-
  • timer or buf is a null pointer
-
As with all bounds-checked functions, gmtime_s only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including <time.h>.
-
-

Parameters

- - -
timer - pointer to a time_t object to convert
buf - pointer to a struct tm object to store the result

Return value

-1) pointer to a static internal tm object on success, or null pointer otherwise. The structure may be shared between gmtime, localtime, and ctime and may be overwritten on each invocation.
-2-3) copy of the buf pointer, or null pointer on error (which may be a runtime constraint violation or a failure to convert the specified time to UTC)

Notes

gmtime may not be thread-safe.

-

POSIX requires that gmtime and gmtime_r set errno to EOVERFLOW if they fail because the argument is too large.

-

The implementation of gmtime_s in Microsoft CRT is incompatible with the C standard since it has reversed parameter order.

-

Example

#define __STDC_WANT_LIB_EXT1__ 1
-#define _XOPEN_SOURCE // for putenv
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>   // for putenv
- 
-int main(void)
-{
-    time_t t = time(NULL);
-    printf("UTC:       %s", asctime(gmtime(&t)));
-    printf("local:     %s", asctime(localtime(&t)));
-    // POSIX-specific
-    putenv("TZ=Asia/Singapore");
-    printf("Singapore: %s", asctime(localtime(&t)));
- 
-#ifdef __STDC_LIB_EXT1__
-    struct tm buf;
-    char str[26];
-    asctime_s(str,sizeof str,gmtime_s(&t, &buf));
-    printf("UTC:       %s", str);
-    asctime_s(str,sizeof str,localtime_s(&t, &buf));
-    printf("local:     %s", str);
-#endif
-}

Possible output:

-
UTC:       Fri Sep 15 14:22:05 2017
-local:     Fri Sep 15 14:22:05 2017
-Singapore: Fri Sep 15 22:22:05 2017
-UTC:       Fri Sep 15 14:22:05 2017
-local:     Fri Sep 15 14:22:05 2017

References

See also

- -
-
(C23)(C11)
converts time since epoch to calendar time expressed as local time
(function)
C++ documentation for gmtime
-

- © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
- https://en.cppreference.com/w/c/chrono/gmtime -

-
-- cgit v1.2.3