Back to Aurora Vision Library Lite website
You are here: Start » System » Time » TimestampToDateTime
TimestampToDateTime
| Header: | STD.h |
|---|---|
| Namespace: | avl |
Converts UTC timestamp to date and time in selected timezone.
Syntax
C++
Python
void avl::TimestampToDateTime ( const avl::Timestamp& inTimestamp, avl::TimezoneKind::Type inTimezone, avl::DateTime& outDateTime )
Parameters
| Name | Type | Default | Description | |
|---|---|---|---|---|
![]() |
inTimestamp | const Timestamp& | UTC timestamp | |
![]() |
inTimezone | TimezoneKind::Type | Timezone to convert to | |
![]() |
outDateTime | DateTime& | Date and time in selected timezone |
Remarks
Assumptions about date and time calculations:
- Timestamp should always be in UTC (Coordinated Universal Time).
- Timestamp can be converted to DateTime using either UTC or local timezone. Other timezones are not supported. However, the timezone offset is saved in DateTime so one can always convert back to UTC.
- Conversion to local time should take into account daylight saving time (summer/winter time), if configured in the operating system. However, usually only currently applicable DST rules are used, so calculations may be incorrect if they refer to a period when the rules were different.
- Timestamp resolution is 100 nanoseconds.
- Timestamp is 64-bit, so should support dates about 29000 years in the past or future. However, the whole range may not be supported when converting to local timezone.
- Dates are calculated in proleptic Gregorian calendar.
- Leap seconds are ignored, like in Unix time.
Errors
List of possible exceptions:
| Error type | Description |
|---|---|
| RuntimeError | Couldn't convert time to local timezone This could mean the date is out of supported range. Set inTimezone to UTC to skip the conversion. |


