3 ms·
For anyone curious: you can't actually get the current time in CSS. In the post they hard-code a starting time and load the page at the right moment.
by hamandcheese 5y ago
For anyone curious: you can't actually get the current time in CSS. In the post they hard-code a starting time and load the page at the right moment.
- TheRealPomax 5y agoJust like real clocks: they don't magically set the right time when you pop in a battery and turn them on - generating the CSS vars in their own file to make sure that right time is used is pretty simple, and the equivalent to presetting a clock for someone when they buy it =)
- bawolff 5y agoReal clocks also dont usually come with headlines claiming that they do.
- lupire 5y agoyour claim is that clocks are not marketed as devices that tell time correctly?
- bawolff 5y agoThey're not marketed as devices that tell the "current" time. Except i guess things like https://www.amazon.ca/Infinity-Itc-Atomic-Clock-Controlled/dp/B001949RCI https://www.amazon.ca/Infinity-Itc-Atomic-Clock-Controlled/d... which do actually auto set the current time.
- fouc 5y agoSeems totally valid for a CSS/HTML clock to basically get the time on "startup", and then run off that. That's similar to how the computer fetches the current time from the quartz crystal on startup.