this post was submitted on 17 Jan 2024
14 points (100.0% liked)

Golang

2197 readers
1 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 1 year ago
MODERATORS
 

I am doing a lot of work right now that requires day and year durations and I have to define those myself. I wonder why they didn't include those in the time package.

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 10 points 9 months ago (1 children)

If they provided constants, someone would complain that they produce the wrong result for daylight savings or leap years.

[–] [email protected] 5 points 9 months ago* (last edited 9 months ago) (1 children)

This - no one can agree how long a day, week, month, year etc are!

Like sure it's 24 hours in a day but is a year 365 days? No, not technically speaking.

Time has always been really hard for programmers.

[–] [email protected] 6 points 9 months ago

Well now I need to go add some tests and fix some bugs. Thanks yall.