The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
1–10 of 106 posts
Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#2You cannot since it's missing time zone
Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#3You cannot since it's missing time zone
UTC is a timezone, though. Or am I misunderstanding what you're saying?
Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#4Until you understand that the core of unix time is the "day", in the end, you only need to know the first leap year (If I recall properly it is 1972), then you have to handle the "rules" of leap years, and you will be ok (wikipedia I think, don't use google anymore since they now force javascript upon new web engines).
I did write such code in RISC-V assembly (for a custom command line on linux to output the statx syscall output). Then, don't be scared, with a bit of motivation, you'll figure it out.
Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#5You cannot since it's missing time zone
UTC is a timezone, though. Or am I misunderstanding what you're saying?
That is fine as long as the input / output is always in UTC... but at the end of the day you often want to communicate that timepoint to a human user (e.g. an appointment time, the time at which some event happened, etc.), which is when our stupid monkey brains expect the ascii string you are showing us to actually make sense in our specific locale (including all of the warts each of those particular timezones have, including leap second, DST, etc.)
Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#6Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#7[deleted]
Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#8Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#9[flagged]
Re: The surprising struggle to get a Unix Epoch time from a UTC string in C or C++
#1013 more years to go until the 2038 problem.
Surely we'll have everything patched up by then..