• fubarx@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    Worked on a project where devices just magically froze, but only during the month of February!

    Turned out the people who had written the firmware had decided to do their own time math to save space and had put in an exception in the code for leap year values. Except instead of February 29th, it kicked in for the whole month. And the math was wrong so you ended up with negative values.

    The product was due for launch in March of that year and was headed to manufacturing. It was by sheer luck that someone ran a test on February 1st and caught the problem.

    Don’t mess with time in code, kids.

  • Malix@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    3 months ago

    I’m ok with timezones, but the guy who invented daylight savings time I’d slap to all the way to the sun

  • arc@lemm.ee
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    3 months ago

    I once developed an electronic program guide for a cable TV company in New Zealand and I’d lose my mind if I had to use timezones. The basic rule of thumb was:

    a) Internally you use UTC religiously. UTC is the same everywhere on Earth, time always goes forward, most languages have classes that represent instants, durations etc. In addition you make damned sure your server time is correct and UTC.

    b) You only deal with timezones when presenting something to a user or taking input from a user

    Prior to that I had worked for a US trading company that set all their servers to EST and was receiving trades through the system which expressed time & date ambiguously. Just had to assume everywhere that EST was the default but it was just dumb programming and I bet to this day every piece of code they develop has time bugs.

    • letsgo@lemm.ee
      link
      fedilink
      arrow-up
      0
      ·
      3 months ago

      Standardising on EST is fine; it’s just UTC plus a constant. If they flipped between EST and EDT, now that’d be insane.