Hacker News new | ask | show | jobs
by kaoD 672 days ago
> multiple bit strings that represent the same date and time

How so?

1 comments

You’re right, whether or not the integers are signed has nothing to do with the issue above. Unsigned integers have the same issue.

Here is an example for signed integers.

These represent zero time but have different representations in memory:

Seconds: 2 Nanoseconds: -2,000,000,000 (fits in a 32 bit number) Time: zero seconds

Seconds: -2 Nanoseconds: 2,000,000,000 Time: zero seconds

Here is an example for unsigned: Seconds: 1 Nanoseconds: 0 Time: 1 second

Seconds: 0 Nanoseconds: 1,000,000,000 Time 1 second

Thanks, but I'm not gonna pretend that was my point. Dumb question from me, I just forgot the context that time was a pair of integers and was utterly confused, haha. You're spot on!