[Top][All Lists]

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

Re: uptime.el

From: Glenn Morris
Subject: Re: uptime.el
Date: Tue, 12 Feb 2008 00:50:06 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Juri Linkov wrote:

> A general time difference function would be definitely useful, but
> what format it should use? For the uptime perhaps the standard
> format of the `uptime' system command is more preferable, e.g.
> "15:16:19 up 51 days 1 year".

Personally I think the `uptime' format ("up 3 days,  6:41") is ugly.

I mean something where you can specify a format-string. I have in mind
something like:

(defun format-seconds (format-string seconds)
  "Use FORMAT-STRING to format the number SECONDS.
The valid format specifiers are:
%y is the number of (365-day) years.
%d is the number of days.
%h is the number of hours.
%m is the number of minutes.
%s is the number of seconds.

Upper-case specifiers are followed by the unit-name (e.g. \"years\").
Lower-case specifiers return only the unit."

together with the ability to say eg "%.3y" for 001 years.

reply via email to

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