FrontPage 

Fuego wiki

Login or create account

Issue 0047 in 'raw' format

; Summary: convert timestamps in Fuego to be RFC 3339-compliant
; Owner: Tim
; Reporter: Tim
; Status: open
; Priority: medium

= Description =
Timestamps in Fuego version 1.1 use a time format that is close to iso8601-compliant, but not exactly.  Specifically, is uses the following shell command
expansion to set the value of BUILD_TIMESTAMP

export BUILD_TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)

This uses underscore as the delimiter between date and time (where ISO860-1 uses 'T'), and dashes between time elements (instead of colons).

ftc (version pre-1.2) currently uses:

timestamp = time.strftime("%Y-%m-^d_%H-%M-%S")

We should add an indicator of timezone.

Is this really needed? I think it's only needed if we need to order or compare
build start times between sites.  I'm not sure yet if this is needed.

See https://tools.ietf.org/html/rfc3339

We should definitely use colons in the time portion of the timestamp.

Here is the RCF3339 spec:

{{{#!YellowBox
   date-fullyear   = 4DIGIT
   date-month      = 2DIGIT  ; 01-12
   date-mday       = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on
                             ; month/year
   time-hour       = 2DIGIT  ; 00-23
   time-minute     = 2DIGIT  ; 00-59
   time-second     = 2DIGIT  ; 00-58, 00-59, 00-60 based on leap second
                             ; rules
   time-secfrac    = "." 1*DIGIT
   time-numoffset  = ("+" / "-") time-hour ":" time-minute
   time-offset     = "Z" / time-numoffset

   partial-time    = time-hour ":" time-minute ":" time-second
                     [time-secfrac]
   full-date       = date-fullyear "-" date-month "-" date-mday
   full-time       = partial-time time-offset

   date-time       = full-date "T" full-time

      NOTE: Per [ABNF] and ISO8601, the "T" and "Z" characters in this
      syntax may alternatively be lower case "t" or "z" respectively.

      This date/time format may be used in some environments or contexts
      that distinguish between the upper- and lower-case letters 'A'-'Z'
      and 'a'-'z' (e.g. XML).  Specifications that use this format in
      such environments MAY further limit the date/time syntax so that
      the letters 'T' and 'Z' used in the date/time syntax must always
      be upper case.  Applications that generate this format SHOULD use
      upper case letters.

      NOTE: ISO 8601 defines date and time separated by "T".
      Applications using this syntax may choose, for the sake of
      readability, to specify a full-date and full-time separated by
      (say) a space character.
}}}
Note the last line, which allows a space character to replace "T", but allows
for a different character for readability.

In order to use timestamps as part of file and directory names, and avoid
problems with file and directory names containing spaces, Fuego chooses
to use an underscore to replace the 'T' in the iso8601 specification,
as the delimiter between the date and time portions of the timestamp.


= Notes =
Note that date can output in rfc3339 format, with 
$(date --rfc-3339=seconds)

Executing this in San Jose (UTC-7), gives:

{{{#!YellowBox
2017-06-29 15:40:09-07:00
}}}

However, this uses a space in between the date and time, instead of a 'T'.

the 'date' command on Ubuntu 14.04 supports the '%:z' option, which shows
timezone information in [-+]hour:minute format.  However, strftime
and python's time.strftime() does not support the %:z option.

They only allow %z, which shows the timezone offset as a single 4-digit
number: e.g. '-0700'


The posix page for strftime does not support the '%:z' options.
http://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html

And strptime doesn't support either %:z or even %z, so apparently 
can't parse the timezone information at all.
see 'man strptime'.

Various python lists have bug reports about the difficulty of parsing RFC3339-format timestamp strings, due to the issue of the colon in the timestamp.

Maybe I should use "%F_%T%z" as the format string instead?

== How to change timezone in Jenkins ==
https://stackoverflow.com/questions/42202070/how-to-change-the-time-zone-in-jenkins

Modify /etc/timezone with your timezone information.

{{{#!YellowBox
 $ cat /etc/timezone
 America/Los_Angeles
}}}

Do a systemwide export of TZ, in /etc/profile

{{{#!YellowBox
 export TZ=America/Los_Angeles
}}}

; backlink: [[Fuego Issues List]]















TBWiki engine 1.8.3 by Tim Bird