Perhaps simpler would be just converting to GMT first:

today >gmt "2014-08-31" ymd>timestamp time- duration>days


On Wed, Sep 3, 2014 at 1:22 AM, Georg Simon <georg.si...@auge.de> wrote:

> Am Tue, 2 Sep 2014 19:09:45 -0700
> schrieb Alex Vondrak <ajvond...@gmail.com>:
>
> Thank you.
>
> > ...
> >
> > That is, if it weren't for the GMT bit, you could just say
> > `"2014-08-31"
> > ymd>timestamp ago duration>days`.  In fact, that would make a nice
> > ymd>word: `:
> > days-ago ( timestamp -- days ) ago duration>days ;`
> >
> But ago includes the time since midnight. So this didn't work.
>
> > (Not sure I would name it `days-ago`, since that's similar to `days
> > ago`, which has a different meaning...but I can't think of a better
> > name.)
> >
> English is not my native language but could days-since be better?
>
> > However, there's the GMT hangup.  I'm not smart enough right now to
> > reason about whether you could just use `ago >gmt` and get the right
> > results, but I'd try it -
> > http://docs.factorcode.org/content/word-__gt__gmt,calendar.html
> >
> Did not work: not a method for the duration class
>
> > Hope any of that helps or gives you some ideas. Let us know what you
> > come up with!
> >
> Yes, important help. Now I see the cause in the information loss when
> generating ymd-strings. So my code explicitly assumes that ymd-strings
> give the local time:
>
> : local-ymd>timestamp ( str -- timestamp )
>     ymd>timestamp gmt-offset-duration >>gmt-offset
>     ;
>  : days-since ( str -- n )
>     today swap local-ymd>timestamp time- duration>days
>     ;
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to