293
submitted 1 month ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 54 points 1 month ago

If you're not using tz_database or equivalents for literally all date-time logic, if 24 or 60*60 are constants defined in your project... you're doing it fucking wrong. I don't know how many times we need to break out the idiot club, but date, time and timezones are extremely complicated - unless your business is primarily concerned with them you must use a library or service.

Do Not Reinvent This Wheel

[-] [email protected] 4 points 1 month ago

What does tz_database do? Wikipedia makes it seem like it basically converts a pair (geocoordinatr, utc time) to local time

[-] [email protected] 6 points 1 month ago

From my very basic understanding, yeah that's basically what it does. However it accounts for a whole lot more into adding or subtracting from UTC. Timezones aren't absolute, they're political. Timezones have weird rules, and history that needs to be somehow expressed in the code to get the right time. That's what's sets tz_database apart from just looking at a map and saying it's +7 UTC.

[-] [email protected] 2 points 1 month ago

So it updates now and then with new rules, and it keeps historical rules for past dates?

[-] [email protected] 2 points 1 month ago

I think so. Like I said, I have a very basic understanding of it. There are definitely a lot of people who know more about this than I do.

[-] [email protected] 3 points 1 month ago

What is tz-database equivalent in batch language ?

this post was submitted on 12 Apr 2024
293 points (96.8% liked)

Programmer Humor

30944 readers
3705 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS