CLOCKTOTIME Convert Clock Vector to Epoch Time

Section: FreeMat Functions

Usage

Given the output of the clock command, this function computes the epoch time, i.e, the time in seconds since January 1,1970 at 00:00:00 UTC. This function is most useful for calculating elapsed times using the clock, and should be accurate to less than a millisecond (although the true accuracy depends on accuracy of the argument vector). The usage for clocktotime is
   y = clocktotime(x)

where x must be in the form of the output of clock, that is

   x = [year month day hour minute seconds]

Example

Here is an example of using clocktotime to time a delay of 1 second
--> x = clock
x = 
  <double>  - size: [1 6]
 
Columns 1 to 3
 2006.000000000000000     6.000000000000000     6.000000000000000  
 
Columns 4 to 6
   21.000000000000000    39.000000000000000    26.329164028167725  
--> sleep(1)
--> y = clock
y = 
  <double>  - size: [1 6]
 
Columns 1 to 3
 2006.000000000000000     6.000000000000000     6.000000000000000  
 
Columns 4 to 6
   21.000000000000000    39.000000000000000    27.330610036849976  
--> clocktotime(y) - clocktotime(x)
ans = 
  <double>  - size: [1 1]
 1.001446008682251