9 lines
676 B
Text
9 lines
676 B
Text
global function timedelta(atom weeks=0, atom days=0, atom hours=0, atom minutes=0, atom seconds=0, atom milliseconds=0, atom microseconds=0)
|
|
-- can be invoked as:
|
|
constant fourdays = timedelta(days:=4)
|
|
-- fourdays = timedelta(0,4) -- equivalent
|
|
-- **NB** a plain '=' is a very different thing
|
|
constant oneday = timedelta(days=1) -- equivalent to timedelta([weeks:=]iff((equal(days,1)?true:false))
|
|
-- - with an error if no local variable days exists.
|
|
constant shift = timedelta(hours:=hours) -- perfectly valid (param hours:=local hours)
|
|
-- timedelta(0,hours:=15,3) -- illegal (it is not clear whether you meant days:=3 or minutes:=3)
|