Talk:c/chrono/tm

Is "public member object" relevant for C? -- A3f.at (talk) 15:46, 15 January 2015 (PST)
 * no, as you can probably tell, this wiki was a C++ reference first. C probably needs something like --Cubbi (talk) 18:14, 16 January 2015 (PST)

Misleading code example
The given code example calls the function with a date (01/01/1900) before the Unix Epoch (01/01/1970). This means the corresponding value is negative. I believe the behavior in such case is platform-dependent. In particular, this code does not work with MSVC : will return -1, and the  will not hold the correct members.

The example should either be changed, or such behavior should be explained. (Or maybe both, since people could believe the currently displayed behavior is portable).

Babbage (talk) 19:29, 25 August 2022 (PDT)
 * good point; the example attempts to demonstrate that struct tm begins in 1900, not 1970, but mktime is in fact specified to update tm only "On successful completion" (which implies not returning -1), and POSIX goes even farther to say "components shall be set to represent the specified time since the Epoch". I'll change the example to something post-epoch --Cubbi (talk) 19:51, 25 August 2022 (PDT)