guix-devel
[Top][All Lists]
Advanced

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

Re: New ‘--list-generations’ and ‘--delete-generations’ options


From: Ludovic Courtès
Subject: Re: New ‘--list-generations’ and ‘--delete-generations’ options
Date: Mon, 09 Sep 2013 18:55:30 +0200
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Nikita Karetnikov <address@hidden> skribis:

>> In that case, would you suggest --list-generations=rec to specify the
>> recutils output format (with no filtering)?
>
> No need for the ‘rec’ part.  I propose to output all generations in the
> recutils format when ‘--list-generations’ is passed.

OK.

>> Age specifications would only be of the kind “at least X days/months
>> old”.  A non-ambiguous syntax is needed, and something more flexible
>> than just ‘last-month’.  Let’s assume ‘string->duration’:
>
>>   "+22"    ⇒ #<time time-duration ...>   ; 22 days
>>   "+2w"    ⇒ #<time time-duration ...>   ; 14 days
>>   "+1m"    ⇒ #<time time-duration ...>   ; 30 days
>
> The plus sign is confusing (we’re subtracting).  I’d rather use ‘22d’,
> ‘2w’, and ‘1m’.

Fine with me.

> How can I subtract 22 days from (current-time) using SRFI-19?

Note that the above example suggests that ‘string->duration’ returns a
time object with of type ‘time-duration’ (thus independent of the
current time.)

Subtraction is done like this:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (subtract-duration (current-time)
                        (make-time time-duration 0 (* 3600 24 22)))
$3 = #<time type: time-utc nanosecond: 357264000 second: 1376844845>
scheme@(guile-user)> (date->string (time-utc->date $3))
$4 = "Sun Aug 18 18:54:05+0200 2013"
--8<---------------cut here---------------end--------------->8---

HTH,
Ludo’.



reply via email to

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