32

For a simple app I'm using to test a devops pipeline I'm outputting the start time of a build to the homepage. On my development machine the year of the ISO-8601 timestamp I expect, 2019, is printed (specifically, "2019-09-12T20:11:00.000Z"). When the same codebase is built using AWS CodeBuild the ISO-8601 timestamp looks like "+051668-02-09T08:09:32.000Z". What is "+051668"? I presume it's the year; My best guess is it's the year represented as a different calendar. Thoughts?

AWS CodeBuild sets this environment variable for every build (CODEBUILD_START_TIME). I'm building with their latest, default, Ubuntu container (v2.0).

  • 1
    @AuxTaco wow, guess this is wrong/incomplete then? i.imgur.com/LgnmacQ.png , deleted my comment – hanshenrik Sep 14 at 8:54
  • 1
    @hanshenrik That grammar doesn't appear to allow for five-digit years at all. I hesitate to say it's wrong, since expanded years are "only allowed by mutual agreement of the partners in information interchange." – AuxTaco Sep 14 at 9:28
66

Most of the google hits show CODEBUILD_START_TIME being represented as the number of milliseconds since 1970. I suspect somewhere in your code you are treating that as if it were seconds.

If you convert +051668-02-09T08:09:32.000Z to seconds you get 1568320819772. If you divide+round that by 1000 you get 1568320819 then convert that back to a human readable time you get September 12, 2019 8:40:19.

  • 4
    Yep, test data was a unix timestamp in seconds! Thought I had grabbed that timestamp directly from CodeBuild logs, but guess not. – trycrmr Sep 12 at 23:11
  • 9
    Bad docs too; Amazon just says "the start time of the build" 😒 – Lightness Races in Orbit Sep 13 at 12:30
  • 4
    Provided some feedback for the docs to be more specific about the timestamp via the link in the bottom right docs.aws.amazon.com/codebuild/latest/userguide/… . – trycrmr Sep 13 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.