2 ms·
yeah...no. don't use floats for this. int64 "nanoseconds since the epoch" seems to be emerging as the de facto standard. used in Golang [0] and adopted by Pyt
by evil-olive 3y ago
yeah...no. don't use floats for this.
int64 "nanoseconds since the epoch" seems to be emerging as the de facto standard.
used in Golang [0] and adopted by Python starting in 3.7 [1]
that PEP also spells out some of the problems with using a float64:
> The Python time.time() function returns the current time as a floating-point number which is usually a 64-bit binary floating-point number (in the IEEE 754 format).
> The problem is that the float type starts to lose nanoseconds after 104 days. Converting from nanoseconds (int) to seconds (float) and then back to nanoseconds (int) to check if conversions lose precision:
0: https://pkg.go.dev/time#Time https://pkg.go.dev/time#Time
1: https://peps.python.org/pep-0564/ https://peps.python.org/pep-0564/
- EdSchouten 3y agoAs far as I know, Go uses year 1 instead of 1970 as its epoch.