back to article Developer’s code worked, but not in the right century

Why hello there Monday! And hello, therefore, to a new instalment of “Who, me?”, The Register’s column in which readers confess to their c*ckups. This week meet “Lars” who told us he once worked for “a large outsourcing company” that assigned him to do some work on a major supermarket chain’s loyalty card program. One of the …

Page:

  1. Shugyosha

    If Denis Norden didn't need to censor 'cockups', I don't think The Reg has to.

    1. HPCJohn

      Can someone explain to me ... why in the blue blazes would a supermarket have its own date format? I guess a database expert can explain.

      But more importantly why is a format like that not documented and given to all developers?

      I know it is not a comparable situation, but I have a great respect for ISO 9001 standards for documents. ISO standards might seem boring in the extreme. However there as a case of a person receiving a radiation overdose because the dose calculation was performed using a superseded document. Far more serious than loyalty points.

      1. Anonymous Coward
        Facepalm

        Re : Can someone explain to me...

        Why this wasn't tested offline first before applying it to a LIVE database ?

        1. Doctor Syntax Silver badge

          Re: Re : Can someone explain to me...

          "Why this wasn't tested offline first before applying it to a LIVE database ?"

          No test database?

          1. MiguelC Silver badge

            Re: Re : Can someone explain to me...

            "No test database?"

            To test in production you write to log instead of DB or do a dry run first, without committing!

          2. Mark 85

            Re: Re : Can someone explain to me...

            "Why this wasn't tested offline first before applying it to a LIVE database ?"

            No test database?

            That wasn't uncommon. Been there, done that and screwed up the "live" data base once... lesson learned. I didn't start seeing test databases until around 2000 due to the costs involved for storage, etc. In at least one case, it was the IT manager who felt that programmers were perfect and thus no need for one.

        2. Stoneshop
          FAIL

          Re: Re : Can someone explain to me...

          Why this wasn't tested offline first before applying it to a LIVE database ?

          You think there's a test database when they did bit fiddling with the date format to save space?

          1. Anonymous Coward
            Anonymous Coward

            Re: Re : Can someone explain to me...

            > You think there's a test database when they did bit fiddling with the date format to save space?

            A test database for the task at hand could be as small as one or two partial records, if need be.

            That said, I am not criticising the person in question as I do not know the whole story.

      2. H in The Hague

        "... ISO standards might seem boring in the extreme."

        I've now reached the age where I consider that far preferable to the wrong kind of excitement.

        (Anyway, those standards mostly say: think about what you're doing, do it consistently, and make sure you can prove it - common sense really.)

        1. Doctor Syntax Silver badge

          "those standards mostly say: think about what you're doing, do it consistently"

          I'm not sure low level customer service agents are allowed to think what they're doing but consistency seems to matter, even if it's done badly. Once something goes wrong any complaint leads to the same wrong being repeated.

          Newspapers often have a weekly column where a journalist manages to sort out various customer issues with big companies. Inevitably the problem has gone round a C/S loop several times without success, gets fixed as soon as it gets tackled out of loop and turns out to be some combination of "unique" and "computer" issue. The only thing unique was that it got handled by the company's press desk who needed a sensible answer. Up to then it had probably been handled strictly according to the C/S scripts with all the consistency that ISO 9000 and the like dictate. A few decades back the talk was of "empowering" C/S. That's been killed in the name of consistency.

      3. katrinab Silver badge

        What is The Standard Date Format?

        No of days since 1st January 1900? (Windows)

        No of days since 2nd January 1904? (Mac)

        No of days since 1st January 1970? (Unix)

        No of days since 1st January 1980? (Sage)

        1. Mage Silver badge
          Coat

          Re: The Standard Date Format?

          I do like YYYY MM DD HH MM SS. Not sure what the standard way to store is. The US printed format MM DD YYYY is a broken idea.

          XKCD Standards

          I think year 0 on computers should have been end of last Ice age in Ireland, or date of founding of first town in the world.

          Two sizes of date / time object?

          Big: Heat death of Universe with resolution of Planck time

          Regular: Expected death of Earth due to Sun + 10 million years, resolution 1 millisecond.

          Yes I know 2 digit year was to save storage and existing start dates are compromises. Many/most run out in less than possible existence of human species.

          Three main issues:

          Start date of storage

          Format(s) of storage

          Human readable formats, not just in Latin script, but all languages.

          1. Doctor Syntax Silver badge

            Re: The Standard Date Format?

            "I think year 0 on computers should have been end of last Ice age in Ireland"

            What's your reference site, Littleton, Sluggan or something else? And are you including pollen zone I or even I, II and III as ice age?

          2. Mystereed

            Re: The Standard Date Format?

            "I do like YYYY MM DD HH MM SS. "

            We had a bug in a script which did a very similar thing to what you did (and a very easy mistake for humans to make) - the log file showed all updates at 7 minutes past the hour, none for any other minute.

            It was July - We needed to use MI instead of MM for the minutes mask :-)

          3. John Brown (no body) Silver badge

            Re: The Standard Date Format?

            "Many/most run out in less than possible existence of human species."

            Is time to start planning for the year Y10K bug yet?

          4. Captain Obvious
            Joke

            Re: The Standard Date Format?

            Looks like you will have a Y10K problem!

            I will get me coat....

          5. jelabarre59

            Re: The Standard Date Format?

            Yes I know 2 digit year was to save storage and existing start dates are compromises. Many/most run out in less than possible existence of human species.

            I had heard some systems in the 1960's had been programmed with *one* digit years. So there were a handful of cases of a "Year 1970 Bug". It should have been a clue that the problem might crop up again.

            And as I remember, Business Basic used a *2-character* (not 2-digit) format for years, so you'd have to use a conversion table to manipulate it in outside code. Not that MAS90 was very friendly with outside-code (was a nightmare dealing with EDI and MAS90).

          6. Allan George Dyer
            Holmes

            Re: The Standard Date Format?

            @Mage: I take your XKCD Standards and raise you

            XKCD ISO 8601.

        2. Stoneshop

          What is The Standard Date Format?

          Way back, when harddisks were Fscking Expensive, I inherited a record[0] catalog database for a library, written in Turbo Pascal. To save space on its very minimal 20MB harddisk, dates were coded as 5 bits day, 4 bits month, and 7 bits year counting from 1900, stored in a 16-bit word. That wasn't too bad, since the only date info used at that point were the date of purchase and maybe a date of retirement of the physical item. However, soon after I took over maintenance we decided to also use the database for recording transactions as well. For this a larger PC was acquired for the princely sum of a tick over Dfl.10000, with a 80MB disk, so space became less of a issue. As the database layout had to change anyway, I decided to store dates as Julian making it a no-brainer to calculate date differences (which one could consider somewhat crucial for a library).

          [0] the vinyl and CD sort.

        3. Anonymous Coward
          Anonymous Coward

          > No of days since 1st January 1970? (Unix)

          Seconds since the Epoch! Not accounting for leap seconds or the fact that at the time of the Epoch (1970-01-01T00:00:00Z) UTC did not yet exist.

          (jumps up and down angrily)

        4. Hans 1
          Happy

          timestamp is a date format

          @Katrinab

          1. Nope, those are timestamps! They are usually [milli]seconds since, NOT days.

          2. 2nd January 1904? (Mac) ? That was up until Mac OS 9 (aka 2000), Mac OS X and macOS use UNIX timestamps.

          Maybe The Register can come up with its own special timestamp ? Milliseconds since el'Reg started ?

          A date format is, for example, [joke]dd/MM/yyyy in the civilized and MM/dd/yyyy in the uncivilized world. Some heretics also like to use dd.MM.yyyy. l33ts use yyyyMMdd.[/joke]

          1. katrinab Silver badge

            Re: timestamp is a date format

            Excel for Mac still uses the 1904 date format, which can cause problems when working on a spreadsheet on both platforms.

          2. phuzz Silver badge

            Re: timestamp is a date format

            "l33ts use yyyyMMdd"

            Also, Japan. It's also known as ISO 8601, and I use it for pretty much everything except talking to people.

            1. Anonymous Coward
              Anonymous Coward

              Re: timestamp is a date format

              > It's also known as ISO 8601, and I use it for pretty much everything except talking to people.

              So you're neither a Basque nor Hungarian speaker¹ then?

              ¹ Other languages also qualify.

          3. Munchausen's proxy
            Pint

            Re: timestamp is a date format

            "Maybe The Register can come up with its own special timestamp ? Milliseconds since el'Reg started ?"

            VMS (and OpenVMS) uses tenths of microseconds starting November 17, 1858.

            1. ROC

              Re: timestamp is a date format

              Full story here:

              http://h41379.www4.hpe.com/wizard/wiz_2315.html

              Looks plausible, but read yourself, and decide ;-}

          4. Anonymous Coward
            Anonymous Coward

            Re: timestamp is a date format

            No joke here. You'll see files with yyyymmdd encoded in the file name for those items that consist of semi-regular snapshots. Usually the Friday Squid Blog on Bruce Schneier's 'blog. I've other troves, but the one that drove the format.

            1. onefang

              Re: timestamp is a date format

              "You'll see files with yyyymmdd encoded in the file name"

              I used a version number and YYYYMMDD as part of the file name for updates once, client had me change it to DDMMYYYY so they could understand it.

          5. Stoneshop
            Boffin

            Re: timestamp is a date format

            Maybe The Register can come up with its own special timestamp ? Milliseconds since el'Reg started ?

            Sheepmarathons (the time required for a sheep at maximum velocity in vacuum to finish a marathon) (straight line, I expect it'll have some problems cornering at that speed).

            That's 0.0070383633 seconds, to be exact.

        5. Jonathan Richards 1

          No standard for epochs - @katrinab

          Those are epochs: the arbitrarily chosen t=0 point for the counter. Formats are the expression of dates in one's chosen calendar.

          PS. In fact, Unix counts seconds since the epoch, hence the approaching Unix Time "Apocalypse".

          1. Doctor Syntax Silver badge

            Re: No standard for epochs - @katrinab

            Unix counts seconds since the epoch, hence the approaching Unix Time "Apocalypse"

            From then link: "On January 19, 2038 03:14:08 GMT all computers that still use 32 bit Unix Time will overflow."

            In 20 years time will there be anything outside of museums still using 32-bit Unix time?

            1. John Brown (no body) Silver badge

              Re: No standard for epochs - @katrinab

              "In 20 years time will there be anything outside of museums still using 32-bit Unix time?"

              Possibly, yes. IIRC parts of the US nuclear deterrent still relies on 8" floppies (or only recently changed)

              1. Stoneshop
                Trollface

                Re: No standard for epochs - @katrinab

                Possibly, yes. IIRC parts of the US nuclear deterrent still relies on 8" floppies

                Launching fiery death in 50 ... 40 ... 30 ... -65510 seconds, abort.

            2. David Nash Silver badge

              Re: No standard for epochs - @katrinab

              "will there be anything outside of museums still using 32-bit Unix time?"

              Of course there will. Some will be embedded or control systems built by suppliers who no longer exist. Those will be the big problems, because the users won't even be aware that a problem is coming.

            3. onefang

              Re: No standard for epochs - @katrinab

              "In 20 years time will there be anything outside of museums still using 32-bit Unix time?"

              In 20 years time I would not be surprised that a certain embedded 32 bit device I'm responsible for is still in use. In 19 years time, remind me to bring that up with the client.

            4. druck Silver badge
              Boffin

              Re: No standard for epochs - @katrinab

              Doctor Syntax wrote:

              From then link: "On January 19, 2038 03:14:08 GMT all computers that still use 32 bit Unix Time will overflow."

              Well it overflows a signed 32 bit number, which will affect a lot of incorrectly written software, but it will be another 68 years before it overflows an unsigned 32 bit number, and really is at the end of the road.

            5. fobobob

              Re: No standard for epochs - @katrinab

              Going by the amount of old COBOL stuff that needed updating for Y2K, I would be far more surprised if there wasn't.

            6. ROC

              Re: No standard for epochs - @katrinab

              Probably some industrial process controller running on 80386 Xenix (assuming 16-bit architecture already fell over (if anyone noticed ....)

          2. Antron Argaiv Silver badge
            Happy

            Re: No standard for epochs - @katrinab

            Unix counts seconds since the epoch, hence the approaching Unix Time "Apocalypse".

            [Somewhere in a dusty corner of an otherwise deserted computer lab, two bearded men are hunched over a Teletype]

            Ken: Date and time, what's it going to be?

            Dennis: Some very large number, so that when it overflows, we won't be around.

            Ken: UINT16?

            Dennis: Better make it UINT32, that should be fine.

            Ken: Right. That should be safe. By the time it rolls over, no one will ever remember UNIX.

        6. tony2heads
          Boffin

          Julian day number

          starting at noon on Monday, January 1, 4713 BC

        7. Gene Cash Silver badge

          Yes, since the date format is such a non-standard, the first thing I do is find out what it is... mainly precipitated by bad experiences like the article's subject.

        8. Anonymous Coward
          Anonymous Coward

          Someone should implement a date format starting at 'around 6 pm on 22 October 4004BCE'.

      4. Peter Prof Fox

        Because computer dates are numbers but real dates aren't

        Not yet. Unknown. Since before we started counting. And so on.

        When did you move into your house? Come on! Come on! YYYY-MM-DD all the bits! I can only remember it was summer 1989. So 1989 is a perfectly valid real world date which isn't 1st Jan 1989.

        Then you need to do sorting and calculations. What is 31st January plus one month? Does 4th August come 'before' or 'after' August? (Neither it is 'in'.) Nobody is sure when Chaucer was born (Roughly 1343) so do we use 'unknown' or wing-it with 1343. J.K. Rowling was born 31 July 1965 so that's fine but what goes in the died field? 'Not yet' which is different from 'unknown'.

        More at http://vulpeculox.net/day/

        1. Doctor Syntax Silver badge

          Re: Because computer dates are numbers but real dates aren't

          Get into historical dates and you have more complications. Julian or Gregorian? Different countries switched at different times and the start of the year isn't necessarily the first of January. (Unix cal always starts with January. man cal, at least back in V7 days, listed that as a bug.)

          Then you get documents with the year given as regnal years and/or the rest of the date relative to a church feast or saint's day. Such documents may relate to property.

          1. Daedalus

            Re: Because computer dates are numbers but real dates aren't

            Julian or Gregorian?

            You're confusing the Julian calendar with the Julian Day. The calendar is extinct, but the Julian day is used in various settings as a date that is the same across all calendars.

            https://en.wikipedia.org/wiki/Julian_day

            1. Doctor Syntax Silver badge

              Re: Because computer dates are numbers but real dates aren't

              "You're confusing the Julian calendar with the Julian Day."

              Oh no I'm not.

              "The calendar is extinct"

              Not if you're dealing with historical material. Just because you don't it doesn't mean that nobody else does. It's building in assumptions like that that lead to failures.

              If you have a Unix-like system with TZ set to one of those for "England and its colonies" (to quote the original man entry) run

              cal 1752

              1. Anonymous Coward
                Anonymous Coward

                Re: Because computer dates are numbers but real dates aren't

                > cal 1752

                Excellent!

                1. Jonathan Richards 1

                  Re: Because computer dates are numbers but real dates aren't

                  > cal 1752

                  [imagine a September where Wed 2 is followed by Thu 14]*

                  Really, that should be dependent on i10n; different countries switched from Julian to Gregorian calendars at different points in time (and hence with different adjustment days omitted). 1752 was the year Britain and its colonies got on board. Turkey held out until 1926.

                  *You have to imagine, because El Reg, he no let me paste monospaced typeface.

              2. John Brown (no body) Silver badge

                Re: Because computer dates are numbers but real dates aren't

                "cal 1752"

                Ah yes, Ephemeral September rather than Eternal September :-)

              3. Olivier2553

                Re: Because computer dates are numbers but real dates aren't

                "The calendar is extinct

                Not if you're dealing with historical material."

                That does not make it less extinct. Like Latin is an extinct language, even if there are professors still teaching Latin.

                I would also assume that historians are not much concerned about the way a computer may handle dates, it is not like your old manuscript is getting out of stock any soon.

Page:

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like