[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20199: Enhancement request for date's "-d" option: different epochs

From: Pádraig Brady
Subject: bug#20199: Enhancement request for date's "-d" option: different epochs
Date: Wed, 25 Mar 2015 13:10:04 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 25/03/15 12:26, Ulrich Windl wrote:
> Hi!
> I'm not subscribed to this list, and I hope this is the right place to report 
> an enhancement request as there seems to be no bugzilla for that.
> Anyway: When downloading the current leap seconds list for out NTP server I 
> realized that the dates there seem to be specified in seconds from 
> 1900-01-01_00:00:00 on one hand, and on the other I realized that date's 
> option "-d" only allows UNIX epochs using the "@" notation.
> Therefore I suggest to allow different starting epochs, possible using a 
> syntax like "date -d '1900-01-01+2287785599'" to print the date and time of 
> 2287785599 seconds past January 1st 1900. ("Like" means I suggest the 
> semantics, but are not really proposing a concrete syntax; possibly there are 
> smarter guy around than me)
> Also being able to decode hexadecimal NTP timestamps would be a nice feature: 
> NTp timestamps look like this:
> d8bd24ef.a8e2bb68 meaning "Wed, Mar 25 2015 13:13:35.659...", so it's 32 bit 
> for the seconds and another 32 bit for the fractional seconds (see page 9 of 
> the PostScript or PDF version of RFC 1305: "NTP timestamps are represented as 
> a 64-bit
> unsigned fixed-point number, in seconds relative to 0h on 1 January 1900. The 
> integer part is in the
> first 32 bits and the fraction part in the last 32 bits.")
> Maybe a "tagged" syntax like "-d NTP:d8bd24ef.a8e2bb6" could be used...
> (For consistency other tags like "UNIX:" for the UNIX epoch and "MS-WIN:" for 
> Microsoft Windows could be used. Again smart guys probably know more 
> important epochs than I do)

Note offsets can be negative, so you could set the offset like:

  $ sec=1234567890
  $ date -d @$(($sec + $(date -d 1/1/1900 +%s)))
  Tue Feb 14 23:56:51 GMT 1939


reply via email to

[Prev in Thread] Current Thread [Next in Thread]