POSIX time (or Unix time) is a time notation, where time is represented as second since Epoch (00:00:00, 1 Jan 1970 UTC). It is used as a base of timekeeping in many operating systems. That means, that if you ask the OS what time it is, it replies in seconds since Epoch. It is then up to the applications (or common libraries that the applications rely on) to convert that to the local calendar time.
What made me realise how cool this is, was that I happened to look at my app, battery-eye, this evening. It was showing something a bit unexpected:
After a moment of confusion, I understood that the artefact (missing hour near the right edge of the screenshot) is a change from DST to normal time.
Now, while writing the app, I have in no way considered DST. The graph drawing algorithm works by asking the OS for current time (in seconds since Epoch), and takes an interval [-30 days, +4 hours] from that. It then iterates that interval to find full hours in that range in local time, with help from the Python library, to know where to draw the vertical lines and time labels.
For my work, I've had the 'pleasure' of digging in to some of the complications of world timekeeping, time zones, DSTs and whatnot. And the whole thing is a big mess, with local authorities changing DST rules whenever they feel like it.
The fact that the POSIX time notation and libraries offer a way that just works for things like DST, while allowing for such linear, unambiguous and simple time representation, is just so cool!
What made me realise how cool this is, was that I happened to look at my app, battery-eye, this evening. It was showing something a bit unexpected:
After a moment of confusion, I understood that the artefact (missing hour near the right edge of the screenshot) is a change from DST to normal time.
Now, while writing the app, I have in no way considered DST. The graph drawing algorithm works by asking the OS for current time (in seconds since Epoch), and takes an interval [-30 days, +4 hours] from that. It then iterates that interval to find full hours in that range in local time, with help from the Python library, to know where to draw the vertical lines and time labels.
For my work, I've had the 'pleasure' of digging in to some of the complications of world timekeeping, time zones, DSTs and whatnot. And the whole thing is a big mess, with local authorities changing DST rules whenever they feel like it.
The fact that the POSIX time notation and libraries offer a way that just works for things like DST, while allowing for such linear, unambiguous and simple time representation, is just so cool!
!!!1
Trout have underwater weapons.