Files
Jeff Bailey 44c5436397 [libc] Add timezone extensions to struct tm and time.h (#203381)
Added timezone extensions to struct tm and time.h:

* struct tm: Added tm_gmtoff and tm_zone, with __tm_gmtoff and __tm_zone
aliases defined as macros.
* time.h: Added tm_gmtoff_t type.

Updated gmtime and localtime to initialize these fields, and enabled %z
and %Z support in strftime.

These changes are implemented unconditionally. While the timezone
database loading is not yet implemented (so local time offsets default
to UTC/0), the timezone formatting and struct field support is fully
complete. Implementing this conditionally would require complex
build-time configuration and conditional inclusion of code, which is
avoided as this implementation is already a complete improvement over
the previous state.

Assisted-by: Automated tooling, human reviewed.
2026-06-11 23:08:04 +01:00

155 lines
3.1 KiB
YAML

header: time.h
standards:
- stdc
macros:
- macro_name: "NULL"
macro_header: null-macro.h
- macro_name: CLOCKS_PER_SEC
macro_header: time-macros.h
types:
- type_name: struct_timeval
- type_name: clockid_t
- type_name: errno_t
- type_name: struct_timespec
- type_name: struct_tm
- type_name: time_t
- type_name: clock_t
- type_name: rsize_t
- type_name: size_t
- type_name: locale_t
- type_name: tm_gmtoff_t
enums: []
objects: []
functions:
- name: asctime
standards:
- stdc
return_type: char *
arguments:
- type: const struct tm *
- name: asctime_r
standards:
- stdc
return_type: char *
arguments:
- type: const struct tm *
- type: char *
- name: ctime
standards:
- stdc
return_type: char *
arguments:
- type: const time_t *
- name: ctime_r
standards:
- stdc
return_type: char *
arguments:
- type: const time_t *
- type: char *
- name: localtime
standards:
- stdc
return_type: struct tm *
arguments:
- type: const time_t *
- name: localtime_r
standards:
- stdc
return_type: struct tm *
arguments:
- type: const time_t *
- type: struct tm *
- name: clock
standards:
- stdc
return_type: clock_t
arguments:
- type: void
- name: clock_gettime
standards:
- posix
return_type: int
arguments:
- type: clockid_t
- type: struct timespec *
- name: clock_settime
standards:
- posix
return_type: int
arguments:
- type: clockid_t
- type: const struct timespec *
- name: difftime
standards:
- stdc
return_type: double
arguments:
- type: time_t
- type: time_t
- name: gettimeofday
standards:
- posix
return_type: int
arguments:
- type: struct timeval *
- type: void *
- name: gmtime
standards:
- stdc
return_type: struct tm *
arguments:
- type: const time_t *
- name: gmtime_r
standards:
- stdc
return_type: struct tm *
arguments:
- type: const time_t *
- type: struct tm *
- name: mktime
standards:
- stdc
return_type: time_t
arguments:
- type: struct tm *
- name: nanosleep
standards:
- posix
return_type: int
arguments:
- type: const struct timespec *
- type: struct timespec *
- name: strftime
standards:
- stdc
return_type: size_t
arguments:
- type: char *__restrict
- type: size_t
- type: const char *__restrict
- type: const struct tm *__restrict
- name: strftime_l
standards:
- stdc
return_type: size_t
arguments:
- type: char *__restrict
- type: size_t
- type: const char *__restrict
- type: const struct tm *__restrict
- type: locale_t
- name: time
standards:
- stdc
return_type: time_t
arguments:
- type: time_t *
- name: timespec_get
standards:
- stdc
return_type: int
arguments:
- type: struct timespec *
- type: int