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
 2007.000000000000000     1.000000000000000     9.000000000000000  
 
Columns 4 to 6
   23.000000000000000    37.000000000000000     5.626970052719116  
--> sleep(1)
--> y = clock
y = 
  <double>  - size: [1 6]
 
Columns 1 to 3
 2007.000000000000000     1.000000000000000     9.000000000000000  
 
Columns 4 to 6
   23.000000000000000    37.000000000000000     6.728925943374634  
--> clocktotime(y) - clocktotime(x)
ans = 
  <double>  - size: [1 1]
 1.1019558906555176