FreeRDP
winpr/libwinpr/timezone/timezone.c File Reference
#include <winpr/config.h>
#include <winpr/environment.h>
#include <winpr/wtypes.h>
#include <winpr/timezone.h>
#include <winpr/crt.h>
#include <winpr/assert.h>
#include <winpr/file.h>
#include "../log.h"
#include "TimeZoneNameMap.h"
#include "TimeZoneIanaAbbrevMap.h"
#include <time.h>
#include <unistd.h>

Macros

#define TAG   WINPR_TAG("timezone")
 
#define MIN(x, y)   (((x) < (y)) ? (x) : (y))
 

Functions

static char * winpr_read_unix_timezone_identifier_from_file (FILE *fp)
 
static char * winpr_get_timezone_from_link (const char *links[], size_t count)
 
static char * winpr_get_unix_timezone_identifier_from_file (void)
 
static char * winpr_time_zone_from_env (void)
 
static char * winpr_translate_time_zone (const char *tzid)
 
static char * winpr_guess_time_zone (void)
 
static SYSTEMTIME tm2systemtime (const struct tm *t)
 
static LONG get_gmtoff_min (const struct tm *t)
 
static struct tm next_day (const struct tm *start)
 
static struct tm adjust_time (const struct tm *start, int hour, int minute)
 
static SYSTEMTIME get_transition_time (const struct tm *start, BOOL toDst)
 
static BOOL get_transition_date (const struct tm *start, BOOL toDst, SYSTEMTIME *pdate)
 
static LONG get_bias (const struct tm *start, BOOL dstBias)
 
static BOOL map_iana_id (const char *iana, LPTIME_ZONE_INFORMATION tz)
 
DWORD GetTimeZoneInformation (LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
 
BOOL SetTimeZoneInformation (const TIME_ZONE_INFORMATION *lpTimeZoneInformation)
 
BOOL SystemTimeToFileTime (const SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime)
 
BOOL FileTimeToSystemTime (const FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime)
 
BOOL SystemTimeToTzSpecificLocalTime (LPTIME_ZONE_INFORMATION lpTimeZone, LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime)
 
BOOL TzSpecificLocalTimeToSystemTime (LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime)
 
DWORD GetDynamicTimeZoneInformation (PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation)
 
BOOL SetDynamicTimeZoneInformation (const DYNAMIC_TIME_ZONE_INFORMATION *lpTimeZoneInformation)
 
BOOL GetTimeZoneInformationForYear (USHORT wYear, PDYNAMIC_TIME_ZONE_INFORMATION pdtzi, LPTIME_ZONE_INFORMATION ptzi)
 
BOOL SystemTimeToTzSpecificLocalTimeEx (const DYNAMIC_TIME_ZONE_INFORMATION *lpTimeZoneInformation, const SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime)
 
BOOL TzSpecificLocalTimeToSystemTimeEx (const DYNAMIC_TIME_ZONE_INFORMATION *lpTimeZoneInformation, const SYSTEMTIME *lpLocalTime, LPSYSTEMTIME lpUniversalTime)
 
DWORD EnumDynamicTimeZoneInformation (const DWORD dwIndex, PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation)
 
DWORD GetDynamicTimeZoneInformationEffectiveYears (const PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation, LPDWORD FirstYear, LPDWORD LastYear)
 

Macro Definition Documentation

◆ MIN

#define MIN (   x,
  y 
)    (((x) < (y)) ? (x) : (y))

◆ TAG

#define TAG   WINPR_TAG("timezone")

WinPR: Windows Portable Runtime Time Zone

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2024 Armin Novak anova.nosp@m.k@th.nosp@m.incas.nosp@m.t.co.nosp@m.m Copyright 2024 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ adjust_time()

static struct tm adjust_time ( const struct tm *  start,
int  hour,
int  minute 
)
static
Here is the caller graph for this function:

◆ EnumDynamicTimeZoneInformation()

DWORD EnumDynamicTimeZoneInformation ( const DWORD  dwIndex,
PDYNAMIC_TIME_ZONE_INFORMATION  lpTimeZoneInformation 
)

◆ FileTimeToSystemTime()

BOOL FileTimeToSystemTime ( const FILETIME *  lpFileTime,
LPSYSTEMTIME  lpSystemTime 
)

◆ get_bias()

static LONG get_bias ( const struct tm *  start,
BOOL  dstBias 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_gmtoff_min()

static LONG get_gmtoff_min ( const struct tm *  t)
static
Here is the caller graph for this function:

◆ get_transition_date()

static BOOL get_transition_date ( const struct tm *  start,
BOOL  toDst,
SYSTEMTIME *  pdate 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_transition_time()

static SYSTEMTIME get_transition_time ( const struct tm *  start,
BOOL  toDst 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDynamicTimeZoneInformation()

DWORD GetDynamicTimeZoneInformation ( PDYNAMIC_TIME_ZONE_INFORMATION  pTimeZoneInformation)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDynamicTimeZoneInformationEffectiveYears()

DWORD GetDynamicTimeZoneInformationEffectiveYears ( const PDYNAMIC_TIME_ZONE_INFORMATION  lpTimeZoneInformation,
LPDWORD  FirstYear,
LPDWORD  LastYear 
)

◆ GetTimeZoneInformation()

DWORD GetTimeZoneInformation ( LPTIME_ZONE_INFORMATION  lpTimeZoneInformation)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTimeZoneInformationForYear()

BOOL GetTimeZoneInformationForYear ( USHORT  wYear,
PDYNAMIC_TIME_ZONE_INFORMATION  pdtzi,
LPTIME_ZONE_INFORMATION  ptzi 
)

◆ map_iana_id()

static BOOL map_iana_id ( const char *  iana,
LPTIME_ZONE_INFORMATION  tz 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ next_day()

static struct tm next_day ( const struct tm *  start)
static
Here is the caller graph for this function:

◆ SetDynamicTimeZoneInformation()

BOOL SetDynamicTimeZoneInformation ( const DYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation)

◆ SetTimeZoneInformation()

BOOL SetTimeZoneInformation ( const TIME_ZONE_INFORMATION lpTimeZoneInformation)

◆ SystemTimeToFileTime()

BOOL SystemTimeToFileTime ( const SYSTEMTIME *  lpSystemTime,
LPFILETIME  lpFileTime 
)

◆ SystemTimeToTzSpecificLocalTime()

BOOL SystemTimeToTzSpecificLocalTime ( LPTIME_ZONE_INFORMATION  lpTimeZone,
LPSYSTEMTIME  lpUniversalTime,
LPSYSTEMTIME  lpLocalTime 
)

◆ SystemTimeToTzSpecificLocalTimeEx()

BOOL SystemTimeToTzSpecificLocalTimeEx ( const DYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation,
const SYSTEMTIME *  lpUniversalTime,
LPSYSTEMTIME  lpLocalTime 
)

◆ tm2systemtime()

static SYSTEMTIME tm2systemtime ( const struct tm *  t)
static
Here is the caller graph for this function:

◆ TzSpecificLocalTimeToSystemTime()

BOOL TzSpecificLocalTimeToSystemTime ( LPTIME_ZONE_INFORMATION  lpTimeZoneInformation,
LPSYSTEMTIME  lpLocalTime,
LPSYSTEMTIME  lpUniversalTime 
)

◆ TzSpecificLocalTimeToSystemTimeEx()

BOOL TzSpecificLocalTimeToSystemTimeEx ( const DYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation,
const SYSTEMTIME *  lpLocalTime,
LPSYSTEMTIME  lpUniversalTime 
)

◆ winpr_get_timezone_from_link()

static char* winpr_get_timezone_from_link ( const char *  links[],
size_t  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_get_unix_timezone_identifier_from_file()

static char* winpr_get_unix_timezone_identifier_from_file ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_guess_time_zone()

static char* winpr_guess_time_zone ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_read_unix_timezone_identifier_from_file()

static char* winpr_read_unix_timezone_identifier_from_file ( FILE *  fp)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_time_zone_from_env()

static char* winpr_time_zone_from_env ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_translate_time_zone()

static char* winpr_translate_time_zone ( const char *  tzid)
static
Here is the call graph for this function:
Here is the caller graph for this function: