Next: WFDBWHICH(1) Up: WFDB Applications Guide Previous: WFDBMAP(1)On This Page


wfdbtime - convert time to sample number, elapsed, and absolute time


wfdbtime -r record time [ time ... ]


Using the specified record as a reference for determining the length of a sample interval and the absolute time represented by sample number 0, this program accepts one or more time arguments (in WFDB standard time format) and produces one line on the standard output for each such argument. In each output line, the corresponding time is written as a sample number (in the form snnn), as an elapsed time interval in hours, minutes, and seconds from the beginning of the record (in the form hh:mm:ss.sss), and as an absolute time and date (in the form [hh:mm:ss.sss DD/MM/YYYY]). If the base time for the record is undefined, the absolute time cannot be calculated, and in this case the elapsed time appears (a second time) instead.

Additional -r record arguments may be given in the same command, to reset the sample interval length and base time for any subsequent time arguments.


The command

wfdbtime -r mimicdb/237/237 0 10:0 s20 "[14:0:0 20/7/1995]" e

produces the output

s0     0:00.000    [12:40:38.000 20/07/1995]

s75000     10:00.000    [12:50:38.000 20/07/1995]

s20     0:00.160    [12:40:38.160 20/07/1995]

s595250     1:19:22.000    [14:00:00.000 20/07/1995]

s19199992     42:39:59.936    [07:20:37.936 22/07/1995]

Note that the input arguments need not be zero-padded, that an input argument in absolute time format must be quoted to protect the brackets from the shell, and that the input argument e is evaluated as the time of the last sample in the input record.


It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).


header file

See Also

time2sec(1) (for further details about standard time format and additional examples)


George B. Moody (


Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 8 March 2019