Unit Timezone

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


Ultibo Timezone Interface unit

Constants



Timezone specific constants TIME_ZONE_*
TIME_ZONE_ID_UNKNOWN = 0;  
TIME_ZONE_ID_STANDARD = 1;  
TIME_ZONE_ID_DAYLIGHT = 2;  
TIME_ZONE_ID_INVALID = DWORD($FFFFFFFF);  


Timezone signature TIMEZONE_SIGNATURE_*
TIMEZONE_SIGNATURE = $ED9A1BC3;  


Type definitions



System time

LPSYSTEMTIME = SysUtils.LPSYSTEMTIME;

SYSTEMTIME = SysUtils.SYSTEMTIME;

TSystemTime = SysUtils.TSystemTime;

PSystemTime = SysUtils.PSystemTime;

_SYSTEMTIME = SysUtils.SYSTEMTIME;

wYear:Word;  
wMonth:Word;  
wDayOfWeek:Word;  
wDay:Word;  
wHour:Word;  
wMinute:Word;  
wSecond:Word;  
wMilliseconds:Word;  

Timezone information

TIME_ZONE_INFORMATION = _TIME_ZONE_INFORMATION;

LPTIME_ZONE_INFORMATION = ^TIME_ZONE_INFORMATION;

TTimeZoneInformation = TIME_ZONE_INFORMATION;

PTimeZoneInformation = PTIME_ZONE_INFORMATION;

PTIME_ZONE_INFORMATION = ^TIME_ZONE_INFORMATION;

_TIME_ZONE_INFORMATION = record

Bias:LONG;  
StandardName:array [0..31] of WCHAR;  
StandardDate:SYSTEMTIME;  
StandardBias:LONG;  
DaylightName:array [0..31] of WCHAR;  
DaylightDate:SYSTEMTIME;  
DaylightBias:LONG;  

Timezone data

PTimezoneData = ^TTimezoneData;

TTimezoneData = record

Name:String[32];  
Description:String[64];  
Bias:LongInt;  
StandardName:String[32];  
StandardBias:LongInt;  
StandardStart:SYSTEMTIME;  
DaylightName:String[32];  
DaylightBias:LongInt;  
DaylightStart:SYSTEMTIME;  

Timezone enumeration callback

TTimezoneEnumerate = function(Timezone:PTimezoneEntry; Data:Pointer):LongWord;

Timezone entry

PTimezoneEntry = ^TTimezoneEntry;

TTimezoneEntry = record

Timezone Properties
Signature:LongWord; Signature for entry validation
Name:array[0..TIMEZONE_NAME_LENGTH - 1] of Char; Timezone name
Description:array[0..TIMEZONE_DESC_LENGTH - 1] of Char; Timezone description
Bias:LongInt;  
StandardName:array[0..TIMEZONE_NAME_LENGTH - 1] of Char; Standard name
StandardBias:LongInt;  
StandardStart:SYSTEMTIME;  
DaylightName:array[0..TIMEZONE_NAME_LENGTH - 1] of Char; Daylight name
DaylightBias:LongInt;  
DaylightStart:SYSTEMTIME;  
Internal Properties
Prev:PTimezoneEntry; Previous entry in Timezone table
Next:PTimezoneEntry; Next entry in Timezone table


Public variables


None defined

Function declarations


Initialization functions

procedure TimezoneInit;
Description: To be documented
Note None documented


Timezone functions

function TimezoneAdd(Data:PTimezoneData; Default:Boolean):LongWord;
Description: Add a Timezone from a timezone data block and to the Timezone table
Note None documented


function TimezoneDelete(Timezone:PTimezoneEntry):LongWord;
Description: To be documented
Note None documented


function TimezoneGetName(Timezone:PTimezoneEntry):String;
Description: To be documented
Note None documented


function TimezoneGetDescription(Timezone:PTimezoneEntry):String;
Description: To be documented
Note None documented


function TimezoneGetBias(Timezone:PTimezoneEntry):LongInt;
Description: To be documented
Note None documented


function TimezoneGetState(Timezone:PTimezoneEntry):LongWord; inline;
Description: Get the state of the supplied Timezone at the current date and time
Timezone The timezone entry to get the state for
Return The TIME_ZONE_ID_* constant representing the standard / daylight state of the timezone


function TimezoneGetStateEx(Timezone:PTimezoneEntry; const DateTime:TDateTime):LongWord;
Description: Get the state of the supplied Timezone at the specified date and time
Timezone The timezone entry to get the state for
DateTime The date and time to get the state of the timezone at
Return The TIME_ZONE_ID_* constant representing the standard / daylight state of the timezone


function TimezoneGetActiveBias(Timezone:PTimezoneEntry):LongInt; inline;
Description: Get the bias (offset between UTC and Local) of the supplied Timezone at the current date and time
Timezone The timezone entry to get the bias for
Return The bias in minutes offset between UTC and Local including any daylight bias if active


function TimezoneGetActiveBiasEx(Timezone:PTimezoneEntry; const DateTime:TDateTime):LongInt;
Description: Get the bias (offset between UTC and Local) of the supplied Timezone at the specified date and time
Timezone The timezone entry to get the bias for
DateTime The date and time to get the bias of the timezone at
Return The bias in minutes offset between UTC and Local


function TimezoneGetStandardName(Timezone:PTimezoneEntry):String;
Description: To be documented
Note None documented


function TimezoneGetStandardBias(Timezone:PTimezoneEntry):LongInt;
Description: To be documented
Note None documented


function TimezoneGetStandardDate(Timezone:PTimezoneEntry; Next:Boolean):TDateTime;
Description: To be documented
Note None documented


function TimezoneGetStandardStart(Timezone:PTimezoneEntry):SYSTEMTIME;
Description: To be documented
Note None documented


function TimezoneGetDaylightName(Timezone:PTimezoneEntry):String;
Description: To be documented
Note None documented


function TimezoneGetDaylightBias(Timezone:PTimezoneEntry):LongInt;
Description: To be documented
Note None documented


function TimezoneGetDaylightDate(Timezone:PTimezoneEntry; Next:Boolean):TDateTime;
Description: To be documented
Note None documented


function TimezoneGetDaylightStart(Timezone:PTimezoneEntry):SYSTEMTIME;
Description: To be documented
Note None documented


function TimezoneFind(const Name:String):PTimezoneEntry;
Description: To be documented
Note None documented


function TimezoneFindByStandard(const StandardName:String):PTimezoneEntry;
Description: To be documented
Note None documented


function TimezoneFindByDaylight(const DaylightName:String):PTimezoneEntry;
Description: To be documented
Note None documented


function TimezoneEnumerate(Callback:TTimezoneEnumerate; Data:Pointer):LongWord;
Description: To be documented
Note None documented


Timezone helper functions

function TimezoneGetCount:LongWord;
Description: Get the current timezone count
Note None documented


function TimezoneGetDefault:PTimezoneEntry;
Description: Get the current default timezone
Note None documented


function TimezoneSetDefault(Timezone:PTimezoneEntry):LongWord;
Description: Set the current default timezone
Note None documented


function TimezoneCheck(Timezone:PTimezoneEntry):PTimezoneEntry;
Description: Check if the supplied Timezone is in the Timezone table
Note None documented


function TimezoneUpdateOffset:LongWord;
Description: To be documented
Note None documented


function TimezoneStartToDateTime(const AStart:SYSTEMTIME; AYear:Word):TDateTime;
Description: Calculate the start date and time from the start date of a timezone
Note None documented


function TimezoneStartToDescription(const AStart:SYSTEMTIME):String;
Description: Get the description of the start date of a timezone
Note None documented


function TimezoneNameReplaceChar(const AName:String; AChar,AReplace:Char):String;
Description: Same as ReplaceChar in UltiboUtils, reproduced here to avoid including extra units
Note None documented


Return to Unit Reference