git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, Shawn Pearce <spearce@spearce.org>,
	Felipe Contreras <felipe.contreras@gmail.com>,
	Eric Raymond <esr@thyrsus.com>, git <git@vger.kernel.org>
Subject: Re: Millisecond precision in timestamps?
Date: Wed, 28 Nov 2012 11:10:19 +0100	[thread overview]
Message-ID: <50B5E30B.5080505@op5.se> (raw)
In-Reply-To: <7v7gp6i3rx.fsf@alter.siamese.dyndns.org>

On 11/28/2012 08:29 AM, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
> 
>> There is room for new headers, and older versions of git will ignore
>> them. You could add a new "committer-timestamp" field that elaborates on
>> the timestamp included on the committer line. Newer versions of git
>> would respect it, and older versions would fall back to using the
>> committer timestamp.
>>
>> But I really wonder if anybody actually cares about adding sub-second
>> timestamp support, or if it is merely "because SVN has it".
> 
> Roundtrip conversions may benefit from sub-second timestamps, but
> personally I think negative timestamps are more interesting and of
> practical use.  Prehistoric projects need them even if they intend
> to switch to Git, never to go back to their original tarballs and
> collection of RCS ,v files.
> 
> And if we were to add "committer-timestamp" and friends to support
> negative timestamps anyway (because older tools will not support
> them), supporting sub-second part might be something we want to
> think about at the same time.
> 
> We would however need to be extra careful.  How should we express
> half-second past Tue Nov 27 23:24:16 2012 (US/Pacific)?  Would we
> spell it 1354087456.5?  1354087456.500?  Would we require decimal
> representation of floating point numbers to be normalized in some
> way (e.g. minimum number of digits without losing precision)?  The
> same timestamp needs to be expressed the same way, or we will end up
> with different commit objects, which defeats the whole purpose of
> introducing subsecond timestamps to support round-trip conversions.
> 
> If we were to use a separate "subsecond" fields, another thing we
> need to be careful about is the order of these extra fields, exactly
> for the same reason.
> 

If we're going to support pre-epoch timestamps, we'll have to do that
for 2.0 anyway, since we'll otherwise have two conflicting dates in
the commit object.

Adding support for parsing them now and start writing them in 2.0
would make sense.

In that case, we'd have to print timestamps as
printf("%lu.%06lu", tv.tv_sec, tv.tv_usec);

I'm unsure how useful it is to support pre-epoch dates though. It's
hard to find software where anyone really cares about the code from
43 years ago with anything but historical interest, and for those
who take the museum road, I'm betting it's more interesting to see
how people worked back then than it is to see what they wrote.

Aside from that, it would be trivial to support museum style history
viewing with a special flag that treats the timestamps as minutes
since 1900-01-01 or some such, giving us plenty of time before even
the first punch-card was invented. It wouldn't be much harder to
let the user specify the timeunit and the start-point either, and
then we could store the history of carbon-based lifeforms on earth
in git.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

  parent reply	other threads:[~2012-11-28 10:10 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27 20:48 Millisecond precision in timestamps? Eric S. Raymond
2012-11-27 21:41 ` Shawn Pearce
2012-11-27 22:06   ` Junio C Hamano
2012-11-27 23:04     ` Eric S. Raymond
2012-11-27 23:49       ` Shawn Pearce
2012-11-28  0:12         ` Eric S. Raymond
2012-11-28  0:22           ` David Lang
2012-11-28  0:26           ` Felipe Contreras
2012-11-28  1:07             ` Shawn Pearce
2012-11-28  1:17               ` Jeff King
2012-11-28  1:29                 ` Jason Pyeron
2012-11-28  1:42                 ` Felipe Contreras
2012-11-28  3:23                 ` Eric S. Raymond
2012-11-28  3:30                   ` Jeff King
2012-11-28  3:44                     ` Felipe Contreras
2012-11-28  3:47                     ` Eric S. Raymond
2012-11-28  4:07                       ` Jeff King
2012-11-28  4:25                         ` Eric S. Raymond
2012-11-28  7:29                 ` Junio C Hamano
2012-11-28  7:58                   ` Eric S. Raymond
2012-11-28  8:04                     ` David Aguilar
2012-11-28 10:14                       ` Andreas Ericsson
2012-12-05 23:37                       ` Robin Rosenberg
2012-12-10 20:56                     ` James Cloos
2012-11-28  8:19                   ` Thomas Berg
2012-11-28  8:44                     ` Felipe Contreras
2012-11-28  9:10                       ` Thomas Berg
     [not found]                         ` <E4C993F4-B7A4-4CB6-A9EA-BFE98BE3A381@gmail.com>
2012-11-29  6:16                           ` Eric S. Raymond
2012-11-29  7:11                           ` Junio C Hamano
2012-11-29  7:22                             ` Felipe Contreras
2012-11-29 10:38                               ` Eric S. Raymond
2012-11-29 16:42                                 ` Junio C Hamano
2012-11-29 19:02                                   ` Eric S. Raymond
2012-11-28 17:57                     ` Junio C Hamano
2012-11-28 10:10                   ` Andreas Ericsson [this message]
2012-11-29 19:14                   ` Phil Hord
2012-11-29 20:01                     ` Jeff King
2012-11-28  1:11             ` Eric S. Raymond
2012-11-28  1:36               ` Felipe Contreras
2012-11-28  2:01       ` Junio C Hamano
2012-11-27 21:44 ` Pyeron, Jason J CTR (US)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50B5E30B.5080505@op5.se \
    --to=ae@op5.se \
    --cc=esr@thyrsus.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).