Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    POSIX time is cool!

    Reply
    juise- | # 1 | 2010-10-30, 23:29 | Report

    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!

    !!!1

    Edit | Forward | Quote | Quick Reply | Thanks

     
    clasificado | # 2 | 2010-10-31, 00:40 | Report

    sure it is!

    it has a lot of shortcomings, but when you dont need to go beyond that barriers, is a pleasure :P

    Edit | Forward | Quote | Quick Reply | Thanks

     
vBulletin® Version 3.8.8
Normal Logout