Introduction

  • The vital file is a file format used in vital recorder for saving vital signs and waveforms
  • It is a single gzip compressed binary file starts with (1F 8B 08 00)
  • It contains a header and a body part
  • Multi-byte variables are encoded using littlen-endian
  • All data structures are arranged in 1-byte units.
  • Caution! Some compilers use 4 byte alignment implicitly.[1]

Data format

  • String data format
  • Strings are encoded in UTF8
  • It contains 4 byte length (without length itself) followed by character array of specified length
  • Caution! It does not include the following NULL(\0) character
  • Time data format
  • Ttimes are stored in UTC
  • UTC can be converted to the local time using time zone bias (offset) in the header part.
  • UTC = local time + tzbias[2]
  • All time data are represented as the number of seconds since 1970/01/01 00:00:00 UTC as a double data format
  • This is compatible with Unix timestamps and convenient for addition and subtraction.
  • Changing the time to __int64 makes the speed slower because it require conversion in every operation.
  • The decimal point is used to indicate the precision below seconds. (for example 0.1 means 100 milliseconds)
  • Because the unix timestamp of year 2020 is 1,606,780,800, 31 bits are enough to express integer part of it. IEEE 754 double data type has 52 bit for fraction part, so 21 digits can be used for the representation of sub second time. 2 ^ 20 is about 1 million, so it has about 1 usec resolution.