From: Stephen D. <sd...@gm...> - 2006-07-10 18:34:04
|
On 7/10/06, Rick Cobb <rc...@kn...> wrote: > We do something fairly strange on our commands that might be useful > here. We treat the string argument for a duration or timer as having 3 > potential signs: "-", "+", and "@". Dash and plus *always* mean > relative-to-now. @ always means absolute time. > > Any given option or argument documents whether its *default sign* is > -,+, or @. For expirations, we usually say that the default is "+". So > "-expiry 5" is 5 seconds from now, while "-expiry @5" expired a long > time ago. > > And it makes parsing a timer or duration a standard operation throughout > our code. Unfortunately, it's in our C++ stuff, so not really suitable > for the Naviserver core. > > Hope this helps -- > -- ReC Yeah, I was wondering about this. Using straight numbers the underlying Tcl obj has it's internal rep shimmered to Long or Ns_Time, which seems like an advantage. What swung it for me was the recent roll over of Unix time to an extra digit. Trying to add a number that large to the current time is clearly an error as the time will overflow, so that seemed like a good place to put the cutoff point. Maybe the signs are more readable in code? I'm hoping you wont have to manually set this much. Limits will save the day, and cure world hunger... |