[alexandria-devel] format-mixed-radix-number, format-duration

Michael Weber michaelw+alexandria at foldr.org
Thu Feb 7 13:55:29 UTC 2008


[accidentally sent as PM only]
On Jan 26, 2008, at 06:38 , Attila Lendvai wrote:

>> ;;; Examples
>> (format-duration nil 86401.5) => "1d0h0m1.50s"
>>
>> (format-duration nil 86401 :format '(" ~,2F second~:P" " ~D
>> minute~:P" " ~D hour~:P" " ~D day~:P")) => " 1 day 0 hours 0 minutes
>> 1.00 second"
>
> imho, such functionality should go into a lib that is specialized for
> date/time handling, because you solve one problem related to
> dates/time with this, but there are many more. where should the line
> be draw?

Not really time/date specific.  unit-specific, perhaps:

(format-mixed-radix-number nil (+ (* 360 60 60) 145210.5) '(60 60  
360) '("~,2F''" "~D'" "~D°")) => "400°20'10.50''"
(format-mixed-radix-number nil (+ (* 360 60 60) 145210.5) '(60 60  
360) '("~,2F''" "~D'" "~D°" "~*")) => "40°20'10.50''"

> i suggest to check out the local-time project. i'll also take a look
> how these functions would fit in there.

Perhaps.


Cheers,
Michael




More information about the alexandria-devel mailing list