# cbLogReadTimeTags()

Reads the date and time values logged in a binary file. This function stores the date values in a dateTags array, and the time values in a timeTags array.

## Function Prototype

C/C++

int cbLogReadTimeTags(char* Filename, int StartSample, int Count, int* DateTags, int* TimeTags)

Visual Basic

Function cbLogReadTimeTags(ByVal Filename$, ByVal StartSample&, ByVal SampleCount&, ByRef Dates&, ByRef Times&) As Long

## Arguments

Filename

The name of the file to retrieve the information from.

StartSample

The first sample to read from the binary file.

Count

The number of samples to read from the binary file

DateTags

Receives the date value for each sample logged in the file. The dates are packed in the following format:

Byte 0: day

Byte 1: month

Byte 2-3: year

TimeTags

Receives the time value for each sample logged in the file. The times are packed in the following format:

Byte 0: seconds

Byte 1: minutes

Byte 2: hours

Byte 3: 0xff = 24hour format; 0x0 = AM; 0x1 = PM

## Returns

- Error code or 0 if no errors
- DateTags – Returns the date values for each sample logged in the file
- TimeTags – Returns the time values for each sample logged in the file.

## Notes

- Time stamped data is returned according to the timeZone preference value and the timeFormat preference value. Refer to cbLogSetPreferences().
- Time stamped data are logged in the file if InstaCal is configured to do so. If time stamps are not logged, the TimeTags and DateTags arrays are filled with values calculated from the file header information.

### Array size

The user is responsible for allocating the size of the DateTags and TimeTags arrays, and ensuring that they are large enough to hold the data that is returned. You can calculate the array allocation using the SampleCount value from cbGetSampleInfo().

int* dates = new int[SampleCount];

int* times = new int[SampleCount];

##### DateTags array

The figure below shows the layout of the DateTags array, and how the elements should be indexed.

where: n is (SampleCount> – 1)

Each sample has only one date. Use the following code fragment to access the elements of the DateTags array:

for (i=0; i<numberOfSamples; i++)

{

d = DateTagsArray[i];

}

##### TimeTags array

The figure below shows the layout of the TimeTags array, and how the elements should be indexed.

where: n is (SampleCount – 1)

Each sample has only one time stamp. Use the following code fragment to access the elements of the TimeTags array:

for (i=0; i<numberOfSamples; i++)

{

t = TimeTagsArray[i];

}