Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

datetime + interval

39 views
Skip to first unread message

Едуард Зозуля

unread,
Mar 24, 2017, 4:59:12 AM3/24/17
to
Hi !

% clock format [clock scan "1 day" -base [clock scan "2017-03-24 23:59:59"]] -format "%Y-%m-%d %H:%M:%S"
2017-03-25 00:00:00
% clock format [clock scan "1 seconds" -base [clock scan "2017-03-24 23:59:59"]] -format "%Y-%m-%d %H:%M:%S"
2017-03-25 00:00:00

first exec must return 2017-03-25 23:59:59

Where am I mistaken?

Matthew Hiles

unread,
Mar 24, 2017, 8:24:58 AM3/24/17
to
It seems it's adding just enough time to make it the next day. so 1 day and 1 second are the same thing when you're 1 second away from the next day. If you want to be 1 day in the future, add 1 day worth of seconds.

% clock format [clock scan "86400 seconds" -base [clock scan "2017-03-24 23:59:59"]] -format "%Y-%m-%d %H:%M:%S"
2017-03-25 23:59:59

Ricardo kozmate.net

unread,
Mar 24, 2017, 8:34:31 PM3/24/17
to
Em 24/03/17 08:59, Едуард Зозуля escreveu:
> % clock format [clock scan "1 day" -base [clock scan "2017-03-24 23:59:59"]] -format "%Y-%m-%d %H:%M:%S"
> 2017-03-25 00:00:00

Also, maybe you could explicitly use [clock add]?

tcl> info patchlevel
8.6.1
tcl> clock format [clock add [clock scan "2017-03-24 23:59:59"] 1 day]
-format "%Y-%m-%d %H:%M:%S"
2017-03-25 23:59:59

--
{ricardo from kozmate.net}

Едуард Зозуля

unread,
Mar 25, 2017, 2:18:53 AM3/25/17
to
суббота, 25 марта 2017 г., 2:34:31 UTC+2 пользователь Ricardo kozmate.net написал:
Thanks !
0 new messages