Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Alex Vondrak
English is not my native language but could days-since be better? Just wanted to chime in here that `days-since` would be the perfect name (as in `2014-08-21 days-since`). English is my native language and I hadn't even thought of this name! :) On Wed, Sep 3, 2014 at 1:22 AM, Georg Simon

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Alex Vondrak
On Thu, Sep 4, 2014 at 4:06 PM, Jon Harper jon.harpe...@gmail.com wrote: How about: : today ( -- timestamp ) now midnight instant gmt-offset ; inline Or really just : today ( -- timestamp ) gmt midnight ; inline if I'm not mistaken. It's a short trip from `today`'s current definition:

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Jon Harper
On Fri, Sep 5, 2014 at 9:52 AM, Alex Vondrak ajvond...@gmail.com wrote: On Thu, Sep 4, 2014 at 4:06 PM, Jon Harper jon.harpe...@gmail.com wrote: How about: : today ( -- timestamp ) now midnight instant gmt-offset ; inline Or really just : today ( -- timestamp ) gmt midnight ; inline

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Georg Simon
But then things go wrong in the rare cases when you change your timezone. I have learned much and now use two new words which solve my problem: : local-ymdtimestamp ( str -- timestamp ) ! str is -MM-DD ymdtimestamp gmt-offset-duration gmt-offset ; : days-since ( str -- n ) ! str

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Alex Vondrak
On Fri, Sep 5, 2014 at 3:34 AM, Jon Harper jon.harpe...@gmail.com wrote: On Fri, Sep 5, 2014 at 9:52 AM, Alex Vondrak ajvond...@gmail.com wrote: On Thu, Sep 4, 2014 at 4:06 PM, Jon Harper jon.harpe...@gmail.com wrote: How about: : today ( -- timestamp ) now midnight instant gmt-offset ;

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Alex Vondrak
I also realize now that this date vs datetime distinction was what Jon was suggesting, whereas I thought he was talking about have one version normalize to local time, have the other normalize to GMT (like Date.current Date.today in Rails). I'm all for a date vs datetime distinction---probably

Re: [Factor-talk] how to calculate count of days

2014-09-05 Thread Jon Harper
On Fri, Sep 5, 2014 at 6:19 PM, Alex Vondrak ajvond...@gmail.com wrote: I also realize now that this date vs datetime distinction was what Jon was suggesting, whereas I thought he was talking about have one version normalize to local time, have the other normalize to GMT (like Date.current