ns_time - Perform various time-related functions
This command provides various time-related functions. Times might be of the form "sec" (integer value), "sec:usec" (NaviServer internal format) or "sec.fraction" (such as the result of ns_time format). The allowed options of ns_time are:
Returns the seconds portion of the current time.
Adjusts time so that it is within the valid range of values for a time. (TODO: Figure out how this is actually useful.)
Computes the time difference between time1 to time2. It does this by subtracting time1 from time2 and returns a string in "sec:usec" format.
Returns the time in seconds in the form of a real number.
Returns the current time in "sec:usec" format.
Increments time by sec seconds and optionally usec microseconds. Returns a string in "sec:usec" format.
Returns a string in the form "sec:usec". usec defaults to zero. If usec is zero, the colon and usec are not returned. If sec is zero, however, it is returned as part of the time string.
Parses a time in "sec:usec" format and returns the seconds portion.
Parses a time in "sec:usec" format and returns the microseconds portion. It assumes zero microseconds if time only contains seconds. All times are relative to 00:00:00 UTC, January 1, 1970 a.k.a. the Unix epoch.
% ns_time 1087006685
% ns_time get 1087013247:598897
% set t [ns_time diff $time $time3] 0:13 % ns_time format $t 0.000013