[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Notes on time and date handling
From: |
Zack Weinberg |
Subject: |
Re: [Monotone-devel] Notes on time and date handling |
Date: |
Tue, 20 Mar 2007 10:10:36 -0700 |
On 3/20/07, William Uther <address@hidden> wrote:
> The other thing I think we should consider changing is date *output*.
> We currently take those ISO 8601 strings straight from the date certs
> and splat them into log output (or whatever). It might make sense to
> convert them to local time and/or to the user's locale's date format.
> This would not be hard to implement.
I wanted to look into this. Was there a process you had in mind to
convert the times?
Approximately what you have, but with a number of adjustments:
- strptime is not the most portable thing; I'd suggest hand-rolling a
parser (perhaps based on the existing date_t::from_string)
- timegm is even less portable, but there is a clever hack described
in the (linux) mktime manpage which could be used as a substitute,
with AC_REPLACE_FUNCS.
- ctime doesn't localize; you want strftime(..., "%c", ...).
- I would recommend having that "%c" be a default, overridable from a lua hook.
zw