File MIES_Utilities_Time.ipf¶
utility functions for time/date related operations
Functions
-
string GetTimeStamp(variable secondsSinceIgorEpoch = defaultValue, variable humanReadable = defaultValue)¶
Return a formatted timestamp of the form
YY_MM_DD_HHMMSS
Uses the local time zone and not UTC.
- Parameters:
humanReadable – [optional, default to false] Return a format viable for display in a GUI
secondsSinceIgorEpoch – [optional, defaults to number of seconds until now] Seconds since the Igor Pro epoch (1/1/1904)
-
variable DateTimeInUTC()
Return the seconds, including fractional part, since Igor Pro epoch (1/1/1904) in UTC time zone.
-
string GetISO8601TimeStamp(variable secondsSinceIgorEpoch = defaultValue, variable numFracSecondsDigits = defaultValue, variable localTimeZone = defaultValue)
Return a string in ISO 8601 format with timezone UTC.
- Parameters:
secondsSinceIgorEpoch – [optional, defaults to number of seconds until now] Seconds since the Igor Pro epoch (1/1/1904) in UTC (or local time zone depending on
localTimeZone
)numFracSecondsDigits – [optional, defaults to zero] Number of sub-second digits
localTimeZone – [optional, defaults to false] Use the local time zone instead of UTC
-
variable ParseISO8601TimeStamp(string timestamp)
Parse a ISO8601 timestamp, e.g. created by GetISO8601TimeStamp(), and returns the number of seconds, including fractional parts, since Igor Pro epoch (1/1/1904) in UTC time zone.
Accepts also the following specialities:
no UTC timezone specifier (UTC timezone is still used)
/
T
between date and timefractional seconds
,
/.
as decimal separator
-
std::tuple<variable, string, string, string, string, string, string, string, string, string, string> ParseISO8601TimeStampToComponents(string timestamp)¶
Parses a ISO8601 timestamp to its components, year, month, day, hour, minute are required and the remaining components are optional and can be returned as empty strings.
-
variable StopAllMSTimers()¶
Stop all millisecond Igor Pro timers.
-
variable RelativeNowHighPrec()¶
Return a time in seconds with high precision, microsecond resolution, using an arbitrary zero point.
-
variable GetReferenceTime()¶
Start a timer for performance measurements.
Usage:
variable referenceTime = GetReferenceTime() // part one to benchmark print GetReferenceTime(referenceTime) // part two to benchmark print GetReferenceTime(referenceTime) // you can also store all times via StoreElapsedTime(referenceTime)
-
variable GetElapsedTime(variable referenceTime)¶
Get the elapsed time in seconds.
-
variable StoreElapsedTime(variable referenceTime)¶
Store the elapsed time in a wave.
-
variable GetDayOfWeek(variable seconds)¶
Returns the day of the week, where 1 == Sunday, 2 == Monday … 7 == Saturday.