make sure the hour we read from the time zone file is constrained to 0-23

This commit is contained in:
Richard Frith-Macdonald 2018-02-04 11:21:47 +00:00
parent b135bc8ae0
commit 54bf6598ed
2 changed files with 7 additions and 2 deletions

View file

@ -1871,6 +1871,10 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
}
while (fscanf(fp, "%d %s", &index, name) == 2)
{
if (index < 0)
index = 0;
else
index %= 24;
[temp_array[index]
addObject: [NSString stringWithUTF8String: name]];
}
@ -1895,8 +1899,8 @@ localZoneString, [zone name], sign, s/3600, (s/60)%60);
path = [zonedir stringByAppendingPathComponent: name];
if ([mgr fileExistsAtPath: path isDirectory: &isDir]
&& isDir == NO
&& [[path pathExtension] isEqual: @"tab"] == NO)
&& isDir == NO
&& [[path pathExtension] isEqual: @"tab"] == NO)
{
zone = [zoneDictionary objectForKey: name];
if (zone == nil)