1 /* strftime( char * restrict, size_t, const char * restrict, const struct tm * restrict )
3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
11 size_t strftime( char * _PDCLIB_restrict s, size_t maxsize, const char * _PDCLIB_restrict format, const struct tm * _PDCLIB_restrict timeptr )
14 If the total number of resulting characters including the terminating null character is not
15 more than maxsize, the strftime function returns the number of characters placed
16 into the array pointed to by s not including the terminating null character.
21 while ( rc < maxsize )
25 if ( ( *s++ = *format++ ) == '\0' )
50 /* tm_wday abbreviated */
57 /* tm_mon abbreviated */
63 /* locale's date / time representation, %a %b %e %T %Y for C locale */
64 /* 'E' for locale's alternative representation */
67 /* tm_year divided by 100, truncated to decimal (00-99) */
68 /* 'E' for base year (period) in locale's alternative representation */
71 /* tm_mday as decimal (01-31) */
72 /* 'O' for locale's alternative numeric symbols */
78 /* tm_mday as decimal ( 1-31) */
79 /* 'O' for locale's alternative numeric symbols */
85 /* last 2 digits of the week-based year as decimal (00-99) */
88 /* week-based year as decimal (e.g. 1997) */
91 /* tm_hour as 24h decimal (00-23) */
92 /* 'O' for locale's alternative numeric symbols */
95 /* tm_hour as 12h decimal (01-12) */
96 /* 'O' for locale's alternative numeric symbols */
99 /* tm_yday as decimal (001-366) */
102 /* tm_mon as decimal (01-12) */
103 /* 'O' for locale's alternative numeric symbols */
106 /* tm_min as decimal (00-59) */
107 /* 'O' for locale's alternative numeric symbols */
113 /* tm_hour locale's AM/PM designations */
116 /* tm_hour / tm_min / tm_sec as locale's 12-hour clock time, %I:%M:%S %p for C locale */
122 /* tm_sec as decimal (00-60) */
123 /* 'O' for locale's alternative numeric symbols */
132 /* tm_wday as decimal (1-7) with Monday == 1 */
133 /* 'O' for locale's alternative numeric symbols */
136 /* week number of the year (first Sunday as the first day of week 1) as decimal (00-53) */
137 /* 'O' for locale's alternative numeric symbols */
140 /* week number as decimal (01-53) */
141 /* 'O' for locale's alternative numeric symbols */
144 /* tm_wday as decimal number (0-6) with Sunday == 0 */
145 /* 'O' for locale's alternative numeric symbols */
148 /* week number of the year (first Monday as the first day of week 1) as decimal (00-53) */
149 /* 'O' for locale's alternative numeric symbols */
152 /* locale's date representation, %m/%d/%y for C locale */
153 /* 'E' for locale's alternative representation */
156 /* locale's time representation, %T for C locale */
157 /* 'E' for locale's alternative representation */
160 /* last 2 digits of tm_year as decimal (00-99) */
161 /* 'E' for offset from %EC (year only) in locale's alternative representation */
162 /* 'O' for locale's alternative numeric symbols */
165 /* tm_year as decimal (e.g. 1997) */
166 /* 'E' for locale's alternative representation */
169 /* tm_isdst / UTC offset in ISO8601 format (e.g. -0430 meaning 4 hours 30 minutes behind Greenwich), or no characters */
172 /* tm_isdst / locale's time zone name or abbreviation, or no characters */
188 #include "_PDCLIB_test.h"
192 TESTCASE( NO_TESTDRIVER );