• uis
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    vor 2 Monaten

    Ok, this is more unix time quirk that can’t handle 24:00:00 and skipping 23:59:59.

    UTC always goes forward regardless of the timezone and local time

    But not unix time.

    I stored program start / end times in UTC

    If your program finishes in less than one seond it might report negative time.

    • arc
      link
      fedilink
      arrow-up
      4
      ·
      vor 2 Monaten

      I didn’t say Unix time, I said UTC. And no it won’t report negative time, not unless somehow the system clock was modified while it was running…

      • uis
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        vor 2 Monaten

        not unless somehow the system clock was modified while it was running…

        Which is how most systems handle leap seconds.

        • arc
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          edit-2
          vor 2 Monaten

          Leap seconds still make time go forwards, not backwards. NTP clients would also resolve small time discrepancies while still advancing forwards prior to the next time sync.

          • uis
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            vor 2 Monaten

            Leap seconds can make time go both ways, but adding them makes time stop/go back because 24:00:00 cannot be represented as 1/86400 part of day N instead of day N+1 on major OSes. And they were only added so far.

            • arc
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              vor 2 Monaten

              It doesn’t work like that. UTC goes forward always. Leap seconds are scheduled and known in advance. NTP time services will just smear time advancement a little to account for an additional second. Time never has to go backwards. This is how Google does it.

              • uis
                link
                fedilink
                arrow-up
                1
                ·
                vor 2 Monaten

                This is how Google does it in their datacenters, but not major OSes by default