bug-gnulib
[Top][All Lists]
Advanced

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

human-time? (was: Re: Proposed module, releasedate)


From: Simon Josefsson
Subject: human-time? (was: Re: Proposed module, releasedate)
Date: Thu, 10 Jan 2008 15:56:16 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

"James Youngman" <address@hidden> writes:

> On Jan 10, 2008 1:06 AM, Bruno Haible <address@hidden> wrote:
>> James Youngman wrote:
>> > Lots of packages get bug reports for releases that are pretty old.
>
>> >   /* emit the standard version information first. */
>> >
>> >   if (release_age (&age))
>> >     {
>> >       double weeks = age / (86400.0 * 7);
>> >       printf(_("This release is %.0f weeks old."),
>> >            weeks);
>> >       if (weeks > 26.0)
>> >       {
>> >         printf(_("  If you are considering reporting a bug,\n"
>> >                  "please upgrade to the most recent release first.\n"));
>> >       }
>>
>> You are assuming that you will be able to make a release at least
>> every 6 months?
>
> Yes.    But that code is in the example, not the module.

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

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:

char *
human_readable (uintmax_t n, char *buf, time_t age)
{
   if (age < 60)
     return xvasprintf ("%d seconds", age);
   else if (age < 60*60)
     return xvasprintf ("%d minutes", age / 60);
   else if (age < 60*60*24)
     return xvasprintf ("%d hours", age / 60 / 60);
   else if (age < 60*60*24*7)
     return xvasprintf ("%d weeks", age / 60 / 60 / 24);
...
}

Plus plural fixes and so on...  I think I could use this to express when
kerberos tickets expired in one of my projects.  Hm.

/Simon




reply via email to

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