Talk:LlGetTimestamp

From Second Life Wiki
Jump to navigation Jump to search

Talk:Hex suggests that we should point away from llGetTimestamp over to llGetTime instead, for more accurate measure of elapsed run time when time dilates. So then likewise we should move the links from llGetTimestamp to Code Racer, Efficiency Tester, and LSL Script Efficiency over to that article instead. -- Ppaatt Lynagh 22:10, 19 October 2007 (PDT)

Timestamp format explanation

Just a short note to explain the time format YYYY-MM-DDThh:mm:ss.ff..fZ, for those not used to the "Wikipedia logo"ISO 8601 format, as defined by the ISO/DIS 8601-1:2016(e)[1]

  • YYYY — Year, four digits (from 1970 to — theoretically — 9999 AC)
  • MM — Month, always two digits, zero-padded, e.g. January would be 01 (not 1!)
  • DD — Day of the month, also always two digits and zero-padded, e. g. the third day of the month would be written as 03
  • T — time designator, a separator indicating that the date part is now over, and the time part begins
  • hh — Hour, always two digits, technically from 00-23 (no AM/PM nonsense!), although 24 is theoretically valid (and means the same as hour 00; very likely never used by LL)
  • mm — Minutes, also always two digits, from 00-59
  • ss — Seconds, always two digits, from 00-59, although there is the concept of a leap second — currently a bit out of fashion — and that means that there might be a 61st second every now and then. It's unknown if LL emits these properly, but the issue should be moot by 2040 anyway, when leap seconds will be discontinued and replaced by something else
  • . [period] — a separator (ISO 8601 allows either a comma or a period, favouring the comma, but software developers have different preferences...)
  • ff..f — A non-standard way of representing fractional seconds. Apparently, according to the page itself, LL is able to emit timestamps with millisecond precision, so, in theory, there would be three digits. One assumes that the non-standard representation means "many fractional digits with whatever precision LL comes up with in the future". Note that there are few standards addressing more than nanosecond precision (9 digits) and it's unlikely that LL's systems are that precise anyway.
  • Z — zone designator, a separator indicating that the time part is finished, and a timezone hour shift now follows. Because llGetTimestamp() always returns time in UTC, there is no need to follow-up with any further information (UTC would always be 00:00, wasting five characters).

Note that the above abbreviations are almost all standardised by ISO 8601 (with the noted exception of the fractional seconds) but programming languages are notoriously non-compliant with such standards and might use different — but confusingly similar! — notations for each. Bear this in mind when examining code that reads timestamps in other programming languages, many of which follow the C/PHP model, but others — Go being one of the most nefarious of all! — using different placeholders and notation formats. Caveat utilitor.

Gwyneth Llewelyn (talk) 13:10, 21 February 2024 (PST)

  1. See an archived copy on the Library of Congress, taken shortly before the ISO requested it to be taken down in 2018: https://web.archive.org/web/20171019211402/https://www.loc.gov/standards/datetime/ISO_DIS%208601-1.pdf