3 ms·
How does time exist without date? And how does time have a timezone without a date? It's the small things in Python that surprise me. I understand the desire
by buro9 13y ago
How does time exist without date?
And how does time have a timezone without a date?
It's the small things in Python that surprise me.
I understand the desire to have truthiness to determine whether it's been set, but a minimum value is a better test than a zero value.
Testing for a "seconds since 1970" would be less bad, and perhaps if you're going to detach time from a concept of date any negative value could be considered the unset/falsey value (which is probably what people testing the value think they're testing).
- cowsandmilk 13y ago> How does time exist without date? How does an alarm clock app store the idea that it is supposed to go off at 6 am every day?
- e12e 13y ago6 am where? Where the app (and presumably you) are, or where you were when you set the alarm? Or better yet, if the alarm is set on a server somewhere: did you mean 6 am where your phone is, where the server is, or where you where when you set the alarm (possibly on a different machine with a different locale). Arguably "in N hours from now" is an unambiguous "time". Possibly so is "in N hours from now, and then every 24 hours" is too, but most places that'll be wrong come daylight saving. An alarm clock app (vs a regular, physical alarm clock) is possibly a bad example for "simple time". Because most apps are connected to a clock that automagically updates somehow, and will then need to "decide" if 6 am is 6 am or some other time. Maybe you just crossed one timezone and don't want to change the (subjective) time you get up, but still need to be able to tell the local time without having to calculate what the local time actually is...