3 minutes reading time
The MAPPS software suite easily combines data for visualization and analysis. Its tools make recording video, eye-tracking, HID, and 3rd-party hardware data with in a networked environment a snap.
Data synchronized by MAPPS relies on timestamps sent with the data. As a Windows focused product, MAPPS uses 64-bit Windows Filetime for its timestamp format. FILETIME is a 64-bit integer that represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight, January 1, 1601 A.D. (UTC). When capturing data, MAPPS Adapters and Video Streamer record the current FILETIME of the PC they're running on as the capture time.
It's also possible to create custom MAPPS adapters and send your own data stream. Custom data should be timestamped with the current Windows FILETIME.
IMPORTANT NOTE: Data capture time is critical when synchronizing streams from different network sources. To minimize clock skew, the clocks of all data sources must be synchronized with a good NTP client such as Meinberg NTP. eyesDx recommends synchronizing all PCs with Meinberg NTP.
Data exported from MAPPS will have a UTC Time (ticks) column. This column is the Windows FILETIME timestamp of the data. It is presented as a 64-bit number. If you want to process exported data in your own software, you can use this column to get the capture time of each data row.
As a Microsoft format, FILETIME is fully supported by Win32 and .NET/
The simplest way to get the current system time as a FILETIME struct is to use the GetSystemTimeAsFileTime function from sysinfoapi.h:
...
FILETIME ft;
;
ULARGE_INTEGER ul;
ul.LowPart = ft.dwLowDateTime;
ul.HighPart = ft.dwHighDateTime;
uint64_t result = ul.QuadPart;
You can also get the current system time with GetSystemTime() from sysinfoapi.h and convert it to a FILETIME struct with SystemTimeToFileTime() from timezoneapi.h
SYSTEMTIME st;
;
FILETIME ft;
; // converts to file time format
ULARGE_INTEGER ui;
ui.LowPart = ft.dwLowDateTime;
ui.HighPart = ft.dwHighDateTime;
int64_t fileTime= ui.QuadPart;
You may want to see the FILETME as a human readable string. A simple way to do this to convert it to SYSTEMTIME and access the parts of the date as needed
SYSTEMTIME st;
;
char buffer;
// Format: YYYY.MM.DD_HH.MM.SS.millisecond
;
std::cout << buffer << std::endl;
C# makes it very easy to get the current time as a FILETIME. You just call ToFileTimeUtc()
var timestamp = DateTime.UtcNow.;
You can also use ToFileTime()
var timestamp = DateTime.UtcNow.;
Just like C++, convert the FILETIME to a DateTime object. DateTime has ToString() method for formatting your output.
DateTime dateTime = DateTime.;
Console.;
Some MAPPS customers use platforms other than Windows. These platforms generally don't support windows FILETIME, but their timestamps can be converted to FILETIME with a little bit of math.
FILETIME is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601. Other time functions often return a time in microseconds from January 1, 1970. We can convert these timestamps by adding a 116444736000000000 to the seconds and multiplying by 10,000,000 to convert seconds to 100s of nanoseconds.
C can get the current time with gettimeofday(). gettimeofday() returns a timeval struct, which has microseconds and seconds since 1970/01/01.
;
We just need to
...
struct timeval tv;
unsigned long long filetime = FT_TO_UNIX ;
;
filetime += tv.tv_sec;
filetime *= 10000000LL; // seconds to 100s of nanosecnds
filetime += tv.tv_usec * 10; // micro-seconds to 100's nanoseconds
Get FILETIME from time.time()
# get current time in seconds and convert to 100s of nanoseconds
= * 10000000
= + 116444736000000000
Get FILETIME from datetime.now()
=
= 116444736000000000 + * 10_000_000
= + * 10
=
=
static final long FILETIME_EPOCH_DIFF ;
long fileTIme ;
Get time since 1970.
// in miliseconds
NSTimeInterval ntpInMiliseconds = [date timeIntervalSince1970]*1000;
// convert to windows filetime
int64_t filetime = ntpInMiliseconds * 10000 + 116444736000000000;
var msSinceEpoch:int64 = Date.timeIntervalSince1970 * 1000.0
var filetime:int64 = milliseconds_since_epoch * 10000 + 116444736000000000;
using std::chrono
unsigned long milliseconds_since_epoch =
std::chrono::system_clock::. /
std::chrono::;
int64_t filetime = milliseconds_since_epoch * 10000 + 116444736000000000;
;
;
filetimeNow;