Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从TCL中的当前时间戳添加1440分钟_Tcl - Fatal编程技术网

从TCL中的当前时间戳添加1440分钟

从TCL中的当前时间戳添加1440分钟,tcl,Tcl,我在使用此代码的TCL中使用了[unixtime]: proc unixtime {} { return [clock seconds] } 如何从返回的时间中添加1440分钟(1天)?使用时钟添加。。。1天: % proc unixtime {} { return [clock seconds] } % set time [unixtime] 1429558336 % clock format $time Mon Apr 20 14:32:16 CDT 2015 % set time [cl

我在使用此代码的TCL中使用了
[unixtime]

proc unixtime {} { return [clock seconds] }

如何从返回的时间中添加1440分钟(1天)?

使用
时钟添加。。。1天

% proc unixtime {} { return [clock seconds] }
% set time [unixtime]
1429558336
% clock format $time
Mon Apr 20 14:32:16 CDT 2015
% set time [clock add $time 1 days]
1429644736
% clock format $time
Tue Apr 21 14:32:16 CDT 2015
注意:这会使时间增加1天。这并不总是1440分钟(24小时)。如果有与夏令时(23或25小时)相关的变化,则可能会或多或少

但是如果你真的想增加1440分钟,使用
clock add。。。1440分钟

% set time [clock add $time 1440 minutes]
1429731136
% clock format $time
Wed Apr 22 14:32:16 CDT 2015
为了说明这一差异,在美国,我们在今年3月8日进入了夏季:

% set time [clock scan "Mar 7 08:00:00 2015"]
1425736800
% clock format $time
Sat Mar 07 08:00:00 CST 2015
% clock format [clock add $time 1 days]
Sun Mar 08 08:00:00 CDT 2015
% clock format [clock add $time 1440 minutes]
Sun Mar 08 09:00:00 CDT 2015

您的意思是从调用命令
unixtime
起需要1天?(即,如果该命令是在2015年1月1日下午1:00调用的,那么该命令将在2015年1月2日下午1:00返回unixtime?@Jerry是的,我想调用它,然后再加上1天)。最好的方法是什么?这是Tcl的标准答案。这样做!