FiffTime
Namespace: FIFFLIB · Library: FIFF Library
#include <fiff/fiff_time.h>
class FIFFLIB::FiffTime
FIFF time stamp: Unix seconds plus a microsecond fraction matching the on-disk fiffTimeRec record.
Layout is two 32-bit fields (secs, usecs) — the exact representation used by FIFF_MEAS_DATE and the per-buffer timestamps embedded in raw data blocks, so an instance can be streamed in and out without per-field marshalling.
QFile structureFile(rawPath);
FiffStream::SPtr stream(new FiffStream(&structureFile));
ok &= stream->open();
const QList<FiffDirEntry::SPtr>& directory = stream->dir(); // every tag (kind, type, size, position) + a kind -1 end
const FiffTime created = stream->id().time; // seconds and microseconds since 1970
stream->close();
Public Methods
FiffTime()
Default constructor.
Initializes both fields to zero.
FiffTime(p_secs, p_usecs)
Parameterized constructor.
Parameters:
-
p_secs : qint32 GMT time in seconds since epoch.
-
p_usecs : qint32 Fraction of seconds in microseconds.
~FiffTime()
Destroys the FiffTime.
Static Methods
storageSize()
Size of the old struct (fiffTimeRec) 2int = 24 = 8.
Returns:
- qint32 — the size of the old struct fiffTimeRec.
Example
- Full source:
src/examples/ex_fiff_structure/main.cpp - Build target:
ex_fiff_structure(runs under CTest) - Data: mne-cpp-test-data
Used in examples
ex_fiff_structure
FIFF library: fixed-length epochs, CTF compensation, the file directory and raw buffers, and handing.
FiffStream::SPtr stream(new FiffStream(&structureFile));
ok &= stream->open();
const QList<FiffDirEntry::SPtr>& directory = stream->dir(); // every tag (kind, type, size, position) + a kind -1 end
const FiffTime created = stream->id().time; // seconds and microseconds since 1970
stream->close();
// mne fiff_open: 640 entries; file_id secs 1411146352, usecs 0
ok &= expect(directory.size() == 641 && directory.last()->kind == -1 && created.secs == 1411146352 && created.usecs == 0 && FiffTime::storageSize() == 8 && FiffDirEntry::storageSize() == 16,
"FiffDirEntry/FiffTime: the 640 tags of mne fiff_open plus the end entry; the file id was written at 1411146352 s");
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>