Lean  $LEAN_TAG$
QuantConnect.TimeZoneOffsetProvider Class Reference

Represents the discontinuties in a single time zone and provides offsets to UTC. This type assumes that times will be asked in a forward marching manner. This type is not thread safe. More...

Public Member Functions

 TimeZoneOffsetProvider (DateTimeZone timeZone, DateTime utcStartTime, DateTime utcEndTime)
 Initializes a new instance of the TimeZoneOffsetProvider class More...
 
long GetOffsetTicks (DateTime utcTime)
 Gets the offset in ticks from this time zone to UTC, such that UTC time + offset = local time More...
 
DateTime ConvertToUtc (DateTime localTime)
 Converts the specified local time to UTC. This function will advance this offset provider More...
 
long GetNextDiscontinuity ()
 Gets this offset provider's next discontinuity More...
 
virtual DateTime ConvertFromUtc (DateTime utcTime)
 Converts the specified utcTime using the offset resolved from a call to GetOffsetTicks More...
 

Properties

DateTimeZone TimeZone [get]
 Gets the time zone this instances provides offsets for More...
 

Detailed Description

Represents the discontinuties in a single time zone and provides offsets to UTC. This type assumes that times will be asked in a forward marching manner. This type is not thread safe.

Definition at line 30 of file TimeZoneOffsetProvider.cs.

Constructor & Destructor Documentation

◆ TimeZoneOffsetProvider()

QuantConnect.TimeZoneOffsetProvider.TimeZoneOffsetProvider ( DateTimeZone  timeZone,
DateTime  utcStartTime,
DateTime  utcEndTime 
)

Initializes a new instance of the TimeZoneOffsetProvider class

Parameters
timeZoneThe time zone to provide offsets for
utcStartTimeThe start of the range of offsets. Careful here, it will determine the current discontinuity offset value. When requested to convert a date we only look forward for new discontinuities but we suppose the current offset is correct for the requested date if in the past.
utcEndTimeThe end of the range of offsets

Definition at line 55 of file TimeZoneOffsetProvider.cs.

Member Function Documentation

◆ GetOffsetTicks()

long QuantConnect.TimeZoneOffsetProvider.GetOffsetTicks ( DateTime  utcTime)

Gets the offset in ticks from this time zone to UTC, such that UTC time + offset = local time

Parameters
utcTimeThe time in UTC to get an offset to local
Returns
The offset in ticks between UTC and the local time zone

Definition at line 90 of file TimeZoneOffsetProvider.cs.

Here is the caller graph for this function:

◆ ConvertToUtc()

DateTime QuantConnect.TimeZoneOffsetProvider.ConvertToUtc ( DateTime  localTime)

Converts the specified local time to UTC. This function will advance this offset provider

Parameters
localTimeThe local time to be converted to UTC
Returns
The specified time in UTC

Definition at line 114 of file TimeZoneOffsetProvider.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNextDiscontinuity()

long QuantConnect.TimeZoneOffsetProvider.GetNextDiscontinuity ( )

Gets this offset provider's next discontinuity

Returns
The next discontinuity in UTC ticks

Definition at line 138 of file TimeZoneOffsetProvider.cs.

◆ ConvertFromUtc()

virtual DateTime QuantConnect.TimeZoneOffsetProvider.ConvertFromUtc ( DateTime  utcTime)
virtual

Converts the specified utcTime using the offset resolved from a call to GetOffsetTicks

Parameters
utcTimeThe time to convert from utc
Returns
The same instant in time represented in the TimeZone

Definition at line 150 of file TimeZoneOffsetProvider.cs.

Here is the call graph for this function:

Property Documentation

◆ TimeZone

DateTimeZone QuantConnect.TimeZoneOffsetProvider.TimeZone
get

Gets the time zone this instances provides offsets for

Definition at line 43 of file TimeZoneOffsetProvider.cs.


The documentation for this class was generated from the following file: