Tcl Source Code

View Ticket
Login
Ticket UUID: 1277715
Title: [clock add] to assume current time
Type: RFE Created on: 2005-08-31 20:05:29
Submitter: kaitzschu Assigned to: kennykb
Subsystem: 06. Time Measurement Severity:
Priority: 5 Medium Last modified: 2026-11-13 11:18:43
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-11-13 11:18:43
Version: None
Description:
Currently (8.5) when one wants to format a specific time other than "now" one has to write

clock format [clock add [clock seconds]]

Clock clock clock doesn't look very attractive.

Because tcl::clock::add already does a check on [llength args] % 2 it wouldn't be such a great hassle.
If uneven number of parameters is given, just

set args [lassign $args clockVal]

instead of erroring out, otherwise set clockVal to [clock seconds]. Would spare poor programmers brain to avoid clock clock clock, wouldn't it.
User Comments:
serhiy.storchaka added on 2026-11-13 11:18:43:

Implemented differently in Tcl 9.0 (TIP 688): clock add and clock format accept now in place of the clock value, e.g. clock format now or clock add now 1 day. See also [1399323fff].