Skip to content

Commit

Permalink
feat: bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
pavkam committed Aug 17, 2020
1 parent a2b78b9 commit a48a357
Show file tree
Hide file tree
Showing 8 changed files with 149 additions and 77 deletions.
14 changes: 7 additions & 7 deletions dist/TZDB.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_UnitSearchPath>bin\$(Config)\$(Platform);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_Build>125</VerInfo_Build>
<VerInfo_Build>126</VerInfo_Build>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.125;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.126;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=</VerInfo_Keys>
<VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
<VerInfo_MinorVer>1</VerInfo_MinorVer>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
Expand All @@ -67,7 +67,7 @@
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<Icon_MainIcon>TZDB.ico</Icon_MainIcon>
<DCC_Namespace>Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.125;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.126;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
</PropertyGroup>
Expand All @@ -80,7 +80,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_MapFile>3</DCC_MapFile>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileVersion=2.1.0.125;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName)</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileVersion=2.1.0.126;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName)</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
Expand All @@ -89,7 +89,7 @@
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.125;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.126;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<DCC_Description>IANA Time Zone Database for Delphi Package</DCC_Description>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -126,7 +126,7 @@
<VersionInfo Name="MajorVer">2</VersionInfo>
<VersionInfo Name="MinorVer">1</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">125</VersionInfo>
<VersionInfo Name="Build">126</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
Expand All @@ -138,7 +138,7 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName">Alexandru Ciobanu</VersionInfoKeys>
<VersionInfoKeys Name="FileDescription">Olson Time Zone Database for Delphi</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">2.1.0.125</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">2.1.0.126</VersionInfoKeys>
<VersionInfoKeys Name="InternalName">IANA Time Zone Database for Delphi</VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright">Alexandru Ciobanu</VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"/>
Expand Down
152 changes: 112 additions & 40 deletions dist/TZDB.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,22 @@

interface
uses
{$IFDEF DELPHI}System.{$ENDIF}SysUtils,
{$IFDEF DELPHI}System.{$ENDIF}DateUtils,
{$IFDEF DELPHI}System.{$ENDIF}Types,
{$IFDEF DELPHI}
System.SysUtils,
System.DateUtils,
System.Types,
System.TimeSpan,
Generics.Collections,
Generics.Defaults,
System.Classes;
{$ELSE}
SysUtils,
DateUtils,
Types,
FGL,
SyncObjs,
Classes;
{$ENDIF}
{$IFDEF DELPHI}System.{$ENDIF}Classes;

type
{$IFNDEF DELPHI}
Expand Down Expand Up @@ -109,6 +113,8 @@ TYearSegment = record
function GetUtcOffset: {$IFDEF DELPHI}TTimeSpan{$ELSE}Int64{$ENDIF}; inline;
function GetStartsAt: TDateTime;
function GetEndsAt: TDateTime;

function UtcTimeInSegment(const AUtcTime: TPreciseTime; out ANoBias: Boolean): Boolean;
public
/// <summary>The date/time when the segment starts.</summary>
/// <returns>A date/time value representing the start of the segment.</returns>
Expand Down Expand Up @@ -153,6 +159,7 @@ TBundledTimeZone = class
{$ENDIF}
FSegmentsByYear: {$IFDEF DELPHI}TDictionary{$ELSE}TFPGMap{$ENDIF}<Word, TYearSegmentArray>;

function GetSpillOverYearBreakdown(const AYear: Word): TYearSegmentArray;
function GetSegment(const AYear: Word; const APreciseTime: TPreciseTime;
const AForceDaylight: Boolean; const AFailOnInvalid: Boolean): TYearSegment;
function GetSegmentUtc(const AYear: Word; const APreciseTime: TPreciseTime): TYearSegment;
Expand Down Expand Up @@ -375,7 +382,7 @@ implementation
SInvalidLocalTime = 'Local date/time value %s is invalid (does not exist in the time zone).';

const
CComponentVersion = '2.1.0.125';
CComponentVersion = '2.1.0.126';

type
{ Day type. Specifies the "relative" day in a month }
Expand Down Expand Up @@ -11633,6 +11640,63 @@ function TYearSegment.GetUtcOffset: {$IFDEF DELPHI}TTimeSpan{$ELSE}Int64{$ENDIF}
Result := {$IFDEF DELPHI}TTimeSpan.FromSeconds(FPeriodOffset + FBias){$ELSE}FPeriodOffset + FBias{$ENDIF};
end;

function TYearSegment.UtcTimeInSegment(const AUtcTime: TPreciseTime; out ANoBias: Boolean): Boolean;
var
FStartsAtUtc, FEndAtUtc: TPreciseTime;
begin
if FType = lttAmbiguous then
begin
{ Check for pre-switch }
FStartsAtUtc := IncSecond(FStartsAt, -FPeriodOffset);
FEndAtUtc := IncSecond(FEndsAt, -FPeriodOffset);

if (ComparePreciseTime(AUtcTime, FStartsAtUtc) >= 0) and
(ComparePreciseTime(AUtcTime, FEndAtUtc) <= 0) then
begin
ANoBias := true;
Exit(true);
end;

{ Check for post-switch }
FStartsAtUtc := IncSecond(FStartsAt, -(FPeriodOffset + FBias));
FEndAtUtc := IncSecond(FEndsAt, -(FPeriodOffset + FBias));

if (ComparePreciseTime(AUtcTime, FStartsAtUtc) >= 0) and
(ComparePreciseTime(AUtcTime, FEndAtUtc) <= 0) then
begin
ANoBias := false;
Exit(true);
end;

end else if FType = lttStandard then
begin
FStartsAtUtc := IncSecond(FStartsAt, -FPeriodOffset);
FEndAtUtc := IncSecond(FEndsAt, -FPeriodOffset);

if (ComparePreciseTime(AUtcTime, FStartsAtUtc) >= 0) and
(ComparePreciseTime(AUtcTime, FEndAtUtc) <= 0) then
begin
ANoBias := true;
Exit(true);
end;

end else if FType = lttDaylight then
begin
FStartsAtUtc := IncSecond(FStartsAt, -(FPeriodOffset + FBias));
FEndAtUtc := IncSecond(FEndsAt, -(FPeriodOffset + FBias));

if (ComparePreciseTime(AUtcTime, FStartsAtUtc) >= 0) and
(ComparePreciseTime(AUtcTime, FEndAtUtc) <= 0) then
begin
ANoBias := true;
Exit(true);
end;
end;

ANoBias := false;
Result := false;
end;

{$IFDEF FPC}
class operator TYearSegment.Equal(const ALeft, ARight: TYearSegment): Boolean;
begin
Expand Down Expand Up @@ -11982,55 +12046,63 @@ function TBundledTimeZone.GetSegment(

function TBundledTimeZone.GetSegmentUtc(const AYear: Word; const APreciseTime: TPreciseTime): TYearSegment;
var
LSegments: TYearSegmentArray;
LSegment: TYearSegment;
LLocal: TPreciseTime;
LNoBias: Boolean;
begin
for LSegment in GetYearBreakdown(AYear) do
LSegments := GetSpillOverYearBreakdown(AYear);
for LSegment in LSegments do
begin

if LSegment.FType = lttAmbiguous then
if LSegment.UtcTimeInSegment(APreciseTime, LNoBias) then
begin
{ Check with both period offset only }
LLocal := IncSecond(APreciseTime, LSegment.FPeriodOffset);
Result := LSegment;

if YearOf(LLocal) <> AYear then
begin
{ Crossed the year threshold. Pass on to next year. }
Exit(GetSegmentUtc(YearOf(LLocal), APreciseTime));
end;
{ Special case when non-biased Ambiguous found - erase it. }
if (LSegment.FType = lttAmbiguous) and LNoBias then
Result.FBias := 0;

if (ComparePreciseTime(LSegment.FStartsAt, LLocal) <= 0) and
(ComparePreciseTime(LSegment.FEndsAt, LLocal) >= 0) then
begin
{ Special case when non-biased Ambiguous found - erase it. }
Result := LSegment;
Result.FBias := 0;
Exit;
end;
Exit;
end;

if LSegment.FType <> lttInvalid then
begin
{ Check for normal segments. }
LLocal := IncSecond(APreciseTime, LSegment.FPeriodOffset + LSegment.FBias);
if YearOf(LLocal) <> AYear then
begin
{ Crossed the year threshold. Pass on to next year. }
Exit(GetSegmentUtc(YearOf(LLocal), APreciseTime));
end;

if (ComparePreciseTime(LSegment.FStartsAt, LLocal) <= 0) and
(ComparePreciseTime(LSegment.FEndsAt, LLocal) >= 0) then
Exit(LSegment);
end;

end;

{ Catch all issue. }
raise EUnknownTimeZoneYear.CreateResFmt(@SDateTimeNotResolvable,
[PreciseTimeToStr(APreciseTime), DoGetID()]);
end;

function TBundledTimeZone.GetSpillOverYearBreakdown(const AYear: Word): TYearSegmentArray;
var
LPrev, LCurr, LNext: TYearSegmentArray;
I, T: Integer;
begin
{ Pull previous year but allow for error to be eaten. }
try
LPrev := GetYearBreakdown(AYear - 1);
except on EUnknownTimeZoneYear do;
end;

LCurr := GetYearBreakdown(AYear);

{ Pull next year but allow for error to be eaten. }
try
LNext := GetYearBreakdown(AYear + 1);
except on EUnknownTimeZoneYear do;
end;

{ Merge all arrays }
SetLength(Result, Length(LPrev) + Length(LCurr) + Length(LNext));
for I := 0 to Length(LPrev) - 1 do
Result[I] := LPrev[I];

T := Length(LPrev);
for I := 0 to Length(LCurr) - 1 do
Result[I + T] := LCurr[I];

T := T + Length(LCurr);
for I := 0 to Length(LNext) - 1 do
Result[I + T] := LNext[I];
end;

class function TBundledTimeZone.GetTimeZone(const ATimeZoneID: string): TBundledTimeZone;
var
LOut: TBundledTimeZone;
Expand Down
8 changes: 4 additions & 4 deletions src/TZCompile/TZCompile.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
<VerInfo_MinorVer>1</VerInfo_MinorVer>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_AutoGenVersion>true</VerInfo_AutoGenVersion>
<VerInfo_Build>125</VerInfo_Build>
<VerInfo_Build>126</VerInfo_Build>
<DCC_BplOutput>..\..\bin\$(Config)\$(Platform)</DCC_BplOutput>
<DCC_DcpOutput>..\..\bin\$(Config)\$(Platform)</DCC_DcpOutput>
<Manifest_File>None</Manifest_File>
<DCC_UnitSearchPath>..\..\bin\$(Config)\$(Platform);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.125;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZCompile;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.126;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZCompile;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=</VerInfo_Keys>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<DCC_ImageBase>00400000</DCC_ImageBase>
<DCC_DcuOutput>..\..\bin\$(Config)\$(Platform)</DCC_DcuOutput>
Expand Down Expand Up @@ -113,7 +113,7 @@
<VersionInfo Name="MajorVer">2</VersionInfo>
<VersionInfo Name="MinorVer">1</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">125</VersionInfo>
<VersionInfo Name="Build">126</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
Expand All @@ -125,7 +125,7 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">2.1.0.125</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">2.1.0.126</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
Expand Down
8 changes: 4 additions & 4 deletions src/TZDBLIB/TZDBLIB.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<VerInfo_Build>125</VerInfo_Build>
<VerInfo_Build>126</VerInfo_Build>
<VerInfo_MinorVer>1</VerInfo_MinorVer>
<DCC_DcpOutput>..\..\bin\$(Config)\$(Platform)</DCC_DcpOutput>
<Manifest_File>None</Manifest_File>
Expand All @@ -44,7 +44,7 @@
<DCC_UnitSearchPath>..\..\bin\$(Config)\$(Platform);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.125;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDBLIB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Alexandru Ciobanu;FileDescription=IANA Time Zone Database for Delphi;FileVersion=2.1.0.126;InternalName=IANA Time Zone Database for Delphi;LegalCopyright=Alexandru Ciobanu;LegalTrademarks=;OriginalFilename=TZDBLIB;ProductName=IANA Time Zone Database for Delphi;ProductVersion=2.1;Comments=</VerInfo_Keys>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<GenDll>true</GenDll>
<DCC_DcuOutput>..\..\bin\$(Config)\$(Platform)</DCC_DcuOutput>
Expand Down Expand Up @@ -118,7 +118,7 @@
<VersionInfo Name="MajorVer">2</VersionInfo>
<VersionInfo Name="MinorVer">1</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">125</VersionInfo>
<VersionInfo Name="Build">126</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
Expand All @@ -130,7 +130,7 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">2.1.0.125</VersionInfoKeys>
<VersionInfoKeys Name="FileVersion">2.1.0.126</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
Expand Down
2 changes: 1 addition & 1 deletion src/TZDBPK/TZDB.pas
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ implementation
SInvalidLocalTime = 'Local date/time value %s is invalid (does not exist in the time zone).';

const
CComponentVersion = '2.1.0.125';
CComponentVersion = '2.1.0.126';

type
{ Day type. Specifies the "relative" day in a month }
Expand Down
Loading

0 comments on commit a48a357

Please sign in to comment.