๐Ÿ’พ Archived View for bbs.geminispace.org โ€บ u โ€บ mbays โ€บ 5201 captured on 2023-11-04 at 16:30:12. Gemini links have been rewritten to link to archived content

View Raw

More Information

โฌ…๏ธ Previous capture (2023-09-28)

โžก๏ธ Next capture (2023-11-14)

๐Ÿšง View Differences

-=-=-=-=-=-=-

Comment by ๐Ÿš€ mbays

Re: "Converting Unix timestamp to date/time"

In: s/programming

So you plan to be part of the Y2038 problem?

๐Ÿš€ mbays

2023-09-11 ยท 8 weeks ago

3 Later Comments โ†“

๐Ÿ‰ gyaradong

some notes:

- a country went into daylight savings and never came out

- countries and states routinely change the dates when coming into or out of daylight savings.

- a country one skipped a week or rewound a week. can't remember which.

- a small island went from one side of the international date line to the other. I think they are now beyond 12 hours forward.

I'm never touching a time library.

๐Ÿฆ€ jeang3nie

Crap, don't get me started on daylight savings time.

๐Ÿš€ stack

I am passing the buck to the user, of course. A variable will keep the timezone adjustment offset, and whoever cares about this will set it to the right amount.

At this point, it is very likely that I will be the only user anyway.

X

Original Post

๐ŸŒ’ s/programming

Converting Unix timestamp to date/time โ€” Without any outside libraries. All we have is a Unix timestamp, seconds since Jan. 1, 1970. I'm looking for a minimalistic solution for my tiny nForth, but really curious if anyone has tricks up their sleeve for this kind of a task. I'm willing to ignore leap seconds for now. So far I got the time part: add timezone in seconds, divide by 86400 to get days, and use the remainder for time in seconds. The rest is trivial, dividing by 60 for minutes and 60...

๐Ÿ’ฌ stack ยท 10 comments ยท 1 like ยท 2023-09-10 ยท 8 weeks ago