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 …

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

45
0

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.

50
1
Silver badge
Facepalm

Re : Can someone explain to me...

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

61
0
Silver badge

"... 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.)

20
0
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)

29
8
Silver badge

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

They've started to censor "Head" from Lou Reed's 'Take A Walk On The Wild Side' on the radio.

6
0

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/

33
0
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.

18
4
Silver badge
Flame

why in the blue blazes would a supermarket have its own date format?

People have already pointed to the multiplicity of (non-)standards. Things were probably even more chaotic when the system was first designed. And who knows, maybe it had gone through something more esoteric, like the software I once had the misfortune to encounter where all the time&date code (among other things) were completely screwed by porting to a different-endian architecture.

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

You must be young! Corporate documentation walks faster than a ripe cheese. Pre-google, it was rare indeed to be able to lay hands on anything that wasn't too patronisingly obvious for anyone to have bothered to nick it. Even if it existed, expect it to describe something that needs you to perform - say - endianness magic (never imagined by the writer) to work.

And to be written to corporate processes. The bit you need was chopped as "too complex" by the tech writer's boss. Any surviving note is buried in a disused septic tank behind something more intimidating than a mere "beware of the leopard" sign (icon for one prospective layer of cover).

21
0
Silver badge

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.

9
1
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)

33
0
Silver badge
Holmes

While I can't speak to supermarkets but while I wore the uniform, we had a unique format for dates on requisitions. You took the last digit of the year and tacked that in front of the day in Julian format (YDDD with DDD being count of days since first of the year.) I had all kinds of fun coding around that. Not just getting a valid date into the supply system, I also had to be able to reverse that from normal calender that we use for all other purpose. Lastly, I needed to be able to do arithmetic in this Julian. Almost forgot. All of it had to be validated (sanity-checked) as I do create contracts for everything I've ever coded and ruthlessly enforce them.

F*ck this up and it's a general courts martial that results. Good fun.

19
0
Silver badge
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]

11
0

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".

6
0
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.

3
0
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?

14
0
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.

12
1
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.

8
0
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.

8
0
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?

13
0
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?

7
4

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 :-)

8
0

Standard Date Format

I think you're all missing the obvious: '..worked for “a large outsourcing company”'. Nuff said.

4
0

why in the blue blazes...

why in the blue blazes would a supermarket have its own date format?

One of my first employers stored future dates and and thus encountered the millennium bug very early.

They had been aware of the problem well before that, but because storage was still expensive, they put it off for a few years. Adding a digit or 2 to all dates was a big deal, requiring the whole database to be unpacked and repacked. It would have taken more than a weekend on the hardware of the time.

They worked around it for awhile by turning the last digit of the year into an alphanumeric (yes it was COBOL) so 2000 was 9A, 2001 was 9B etc.

They had come to a longer term fix by the time I left, just before they ran out of letters.

7
0

They're selling hippie wigs in Woolworths, man. The greatest decade in the history of mankind is over. And as Presuming Ed here has so consistently pointed out, we have failed to paint it black.

3
1
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?

3
0
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)

3
0
Silver badge
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?

12
2
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.

7
0
Silver badge

They've started to censor "Head" from Lou Reed's 'Take A Walk On The Wild Side' on the radio.

Absolute Radio, by some chance?

Yeah, the line "But she never lost her head, even while giving ____" shows how stupid censoring one word is. They'd probably say "it's the meaning, not the word", but if so why have I recently heard them play the lyrics "will she go down on you in a theatre" and "she can only come when she's on top"?

Censorship is sh*t.

9
0

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

YYYY-MM-DD all the bits!

Plus I shudder to think about the Y10k problem, when we need to add a digit to the date format...

1
0
Boffin

Julian day number

starting at noon on Monday, January 1, 4713 BC

2
0
Joke

Re: The Standard Date Format?

Looks like you will have a Y10K problem!

I will get me coat....

2
0
Bronze badge

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).

3
0
Silver badge
Trollface

Re: why in the blue blazes...

They had come to a longer term fix by the time I left, just before they ran out of letters.

After Z, maybe switch to Unicode?

4
0
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.

3
0
Silver badge

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

3
0
Silver badge
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.

6
0
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.

14
0
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!

5
0
Silver badge

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.

2
0
Silver badge
Gimp

Captain's Log

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.

What do you want to bet the date format was stardates? So today's stardate is 1806.18 (or 201806.18).

Fanboi icon chosen because.

3
0
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?

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.

5
0
Silver badge

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

That's an "assumption" you'll find in bold type in a highlighted box in my code. I really don't "expect" anyone to be using dBase II, III or Clipper but "it's the military, stupid." God, that's going back to things I still shudder about.

3
0
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.

5
0
Silver badge

YDDD with DDD being count of days since first of the year

There is a variation of that spec which can be encountered in industry: DDD is the count of days since first of the year, except leap years where 29th Feb is daycode 366. All other days in a leap year have the same daycode as they would have in a non-leap year. Arguably more consistent in some perverse way, but not good if thinking of sorting by these codes to check stock rotation.

YDDD also depends on maximum life of any item to be less than ten years.

2
0
Silver badge
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
0
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.

0
0
Anonymous Coward

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

> and the start of the year isn't necessarily the first of January.

Correct. For example in Catholic countries, dates between 25 December and 31 December in documents more than about 130 years old required context or expert local knowledge to disambiguate the year.

2
0
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
0

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

Forums

Biting the hand that feeds IT © 1998–2018