Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-11-13
11:18 • Closed ticket [1399323fff]: Enhancement: clock format now ... and [clock add n... artifact: ab8c96fe85 user: serhiy.storchaka
11:18 • Closed ticket [1277715fff]: clock add to assume current time plus 6 other ... artifact: 3d2e426f57 user: serhiy.storchaka
2007-04-20
11:13 • Ticket [1399323fff] Enhancement: clock format now ... and clock add now ...<... artifact: 38ef442a62 user: kennykb
2006-01-09
17:04 • Ticket [1399323fff]: 1 change artifact: 3b9ee5ca54 user: dkf
15:52 • Ticket [1399323fff]: 1 change artifact: a7b1af6291 user: dkf
2006-01-08
01:48 • Ticket [1399323fff]: 1 change artifact: f620ffc883 user: rbrunner
2006-01-07
18:37 • New ticket [1399323fff]. artifact: c3cacdb82f user: rbrunner

Enhancement: [clock format now ...] and [clock add now ...]

Closed / Fixed1399323fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 19 days ago
Descriptionplain2006-01-07 18:37:39
The following enhancement would be nice. (See c.l.t for
reasonging)

> cvs diff -u clock.tcl
Index: clock.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/library/clock.tcl,v
retrieving revision 1.29
diff -u -r1.29 clock.tcl
--- clock.tcl   27 Dec 2005 17:39:02 -0000      1.29
+++ clock.tcl   7 Jan 2006 14:43:25 -0000
@@ -708,8 +708,12 @@
            "cannot use -gmt and -timezone in same call"
     }
     if { ![string is wide -strict $clockval] } {
-       return -code error \
-           "expected integer but got \"$clockval\""
+       if { [string eq now $clockval] } {
+           set clockval [clock seconds]
+       } else {
+           return -code error \
+                   "expected integer but got
\"$clockval\""
+       }
     }
     if { ![string is boolean -strict $gmt] } {
        return -code error \
@@ -4301,7 +4305,11 @@
              ?-gmt boolean? ?-locale LOCALE?
?-timezone ZONE?\""
     }
     if { [catch { expr wide($clockval) } result] } {
-       return -code error $result
+       if { [string eq now $clockval] } {
+           set clockval [clock seconds]
+       } else {
+           return -code error $result
+       }
     }

     set offsets {}
Referenced by1
  • 3d2e426f57Closed ticket [1277715fff]: [clock add] to assume current time plus 6 other changes ticket2026-11-13 11:18:43
rbrunner Ticket [1399323fff]: 1 change [History diff]2006-01-08 01:48:03
dkf Ticket [1399323fff]: 1 change [History diff]2006-01-09 15:52:06
dkf Ticket [1399323fff]: 1 change [History diff]2006-01-09 17:04:52
kennykbplain2007-04-20 11:13:18
data_type - 360894
serhiy.storchakawiki2026-11-13 11:18:43

Implemented in Tcl 9.0 (TIP 688): clock format, clock add and clock scan -base accept now as the clock value, e.g. clock format now and clock add now 1 day.

Log in (anonymous is fine) to add a comment.