Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.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
Erlang:将元组相加?_Erlang_Tuples_Addition_Systemtime - Fatal编程技术网

Erlang:将元组相加?

Erlang:将元组相加?,erlang,tuples,addition,systemtime,Erlang,Tuples,Addition,Systemtime,我尝试这样做是为了使新日期比当前系统时间提前90秒: 12> {{00,00,00},{00,01,30}}+erlang:localtime(). ** exception error: an error occurred when evaluating an arithmetic expression in operator +/2 called as {{0,0,0},{0,1,30}} + {{2013,3,8},{6,3,33}} 有什么简单的方法可

我尝试这样做是为了使新日期比当前系统时间提前90秒:

12> {{00,00,00},{00,01,30}}+erlang:localtime().
** exception error: an error occurred when evaluating an arithmetic expression
     in operator  +/2
        called as {{0,0,0},{0,1,30}} + {{2013,3,8},{6,3,33}}

有什么简单的方法可以做到吗?

不能只在erlang中添加元组。您可以在元组中添加单个整数,但要操纵时间,您应该使用
日历
模块():


不能只在erlang中添加元组。您可以在元组中添加单个整数,但要操纵时间,您应该使用
日历
模块():

1> Added = calendar:datetime_to_gregorian_seconds(calendar:local_time()) + 90.
63529954043
2> calendar:gregorian_seconds_to_datetime(Added).
{{2013,3,8},{9,27,23}}