bug-gnulib
[Top][All Lists]
Advanced

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

Re: human-time?


From: Simon Josefsson
Subject: Re: human-time?
Date: Thu, 10 Jan 2008 17:13:43 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Simon Josefsson wrote:
>> This thread reminds me of this poor warning message from make:
>>
>> make: Warning: File `Makefile.am' has modification time 7.9e+02 s in the 
>> future
>
> This was already reported and fixed: see [1].

That's good.

>> There are humans that don't instinctual feel whether '7.9e+02 s' is a
>> time difference in milliseconds or years...
>>
>> Compare this to the useful human.c in gnulib to print file sizes as
>> human readable values, i.e. to print 2.5T instead of 2801285853933.
>>
>> Perhaps there is room for a module that works like:
>
> Very good idea! I mean, some software like [2][3] already does this, and
> it makes the output really understandable without thinking.
>
> Can you write such a module?

Working on it now, it was an interesting idea.

> The function should probably have a parameter controlling the precision
> (1 or 2 units); for example 49 hours can be "2 days" or "2 days 1 hour".

The simplest would be to use the one-unit primitive function
recursively, i.e., something like:

   human_readable_time (49*24*60*60, 2) =
    "2 days " || human_readable_time (1*24*60*60, 1) =
    "2 days 1 hour"

or if you want complete precision:

   human_readable_time (49*24*60*60+65, INF) =
    "2 days " || human_readable_time (1*60*60+65, INF-1) =
    "2 days 1 hour" || human_readable_time (65, INF-2) =
    "2 days 1 hour 1 minute" || human_readable_time (5, INF-3) =
    "2 days 1 hour 1 minute 5 seconds"

However, I fear a translation nightmare.  Is it possible to express age
in this concatenated way in all languages?

In Swedish it will be:

5 dagar 8 timmar 3 minuter 8 sekunder

and I can't think of some corner-cases when it will sound funny, but I'm
suspect there are languages where this won't work.

/Simon




reply via email to

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