Friday, April 17, 2020

This is lame

<rant>
I'm reading in a file called “telemetry.json”. The contents resemble this:
start_time:2020-04-17:08-32-45
end_time:2020-04-17:09-18-07
  • Despite the file name, this isn't JSON format.
  • The timestamps are in some weird format. Who puts dashes between the time entries?
  • It's anybody's guess whether this is local time or GMT.
So instead of just writing objectMapper.readValue(), I had to write a page and a half of code that reads the file a line at a time, splits the line into a key and value string, runs the value string through a custom date parser, and constructs a telemetry POJO to hold the results. I'm guessing this is in local time. I just have to hope the machine that wrote the file is physically in the same time zone as the machine that ends up reading the file (that'll make a truly obscure bug).

There are libraries to write JSON files. Someone was too lazy or ignorant to use them. There is a standard date/time format, ISO 8601, and libraries to read and write timestamps with actual time zone information. Someone was too lazy to use them. Anyone want to take a bet that this is written with a Python script? So now I have to do the extra work to make up for someone else's laziness.

Amateurs.

I lose the bet. It's 13 different shell scripts.
</rant>