Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Helper functions

The table below describes the Brew MP helper functions for time services.

The helper functions are defined in AEEStdLib.h in the platform\system\inc directory in the Brew MP Platform. The helper functions cannot be used in MOD1 modules (AEEStdLib.h functions are not supported in MOD1, only MOD).

Function Description
GETTIMEMS Returns the number of milliseconds that have elapsed since the most recent occurrence of 00:00:00 local time.
GETTIMESECONDS Returns the number of seconds that have elapsed since January 6, 1980 00:00:00 UTC. The returned value is adjusted for UTC leap seconds as well as the local time zone and daylight savings time.

In Brew MP 1.0.2, the local time offset is also available in the Brew MP settings ( /BREW/DeviceSettings/sysclock/localtime_offset/nSecs). For MOD1, a value equivalent to that returned by GETTIMESECONDS can be obtained by adding the value of this setting to the time returned by ISysClock_GetTimeS().

GETUPTIMEMS Returns the number of milliseconds that have elapsed since BREW was initialized.

For MOD1, use ISysTimer_GetTimeRef().

GETUTCSECONDS Returns the number of seconds that have elapsed since the epoch (January 6, 1980 00:00:00 UTC).

For MOD1, this value can be obtained from AEECLSID_SysClock by calling ISysClock_GetTimes().

GETJULIANDATE Fills the JulianType data structure specified by the second parameter based on the time specified by the first parameter (the time is specified as a number of seconds that have elapsed since January 6, 1980 00:00:00 UTC). If the specified time is 0, GETTIMESECONDS() is used.

For MOD1, use stdtime_AddSeconds() and stdTime_GetDiffSeconds(). Note that the date format is different than that of GETJULIANDATE.

JULIANTOSECONDS Returns the number of seconds since the epoch that is the equivalent of the specified Julian date and time.
LOCALTIMEOFFSET Returns the local time zone offset from Coordinated Universal Time (UTC), in seconds.

In Brew MP 1.0.2, the local time offset is also available in the Brew MP settings ( /BREW/DeviceSettings/sysclock/localtime_offset/nSecs). For MOD1, the value of this setting can be used instead of LOCALTIMEOFFSET.