Skip to content

Commit e8184ed

Browse files
committed
Fix handling of time zones less than an hour before UTC
Time zone offsets between -1:00 and 00:00 were being incorrectly handled. Such a time zone does not actually exist today, but if it ever does it will now work.
1 parent 4c63010 commit e8184ed

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

main-command.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,8 @@ int main(int argc, char** argv)
479479
{
480480
/* Found colon. Split into two. */
481481
sscanf(optarg, "%d:%d", &TimeZoneHours, &TimeZoneMins);
482-
if (TimeZoneHours < 0)
482+
/* Can't look at sign of TimeZoneHours because it might be -0 */
483+
if (*optarg == '-')
483484
TimeZoneMins *= -1;
484485
} else {
485486
/* No colon. Just parse. */

tests/data/test177.param

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# End result is same as test 29
1+
# End location is the same as test 29
22
TITLE='Correlate a file with subsecond interpolation and fractional photooffset'
33
PRECOMMAND='cat "$STAGINGDIR/point1-4.jpg" >"$LOGDIR/test.jpg"'
44
# Run in C locale to correctly parse these decimal numbers

tests/data/test185.param

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# End result is the same as test 29
2+
TITLE='Correlate a file with -00:30 time zone'
3+
PRECOMMAND='cat "$STAGINGDIR/point1-1.jpg" >"$LOGDIR/test.jpg"'
4+
COMMAND='$PROGRAM -t -z -00:30 -O -1800 -g "$STAGINGDIR/track2.gpx" "$LOGDIR/test.jpg" > "$OUTFILE" 2>&1 && exiv2 -pv pr "$LOGDIR/test.jpg" >> "$OUTFILE" 2>&1'
5+
POSTCOMMAND='rm -f "$LOGDIR/test.jpg"'
6+
RESULTCODE=0

tests/data/test185.result

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Reading GPS Data...
2+
Legend: . = Ok, / = Interpolated, < = Rounded, - = No match, ^ = Too far
3+
w = Write Fail, ? = No EXIF date, ! = GPS already present
4+
5+
Correlate: /
6+
7+
Completed correlation process.
8+
Matched: 1 (0 Exact, 1 Interpolated, 0 Rounded).
9+
Failed: 0 (0 Not matched, 0 Write failure, 0 Too Far,
10+
0 No Date, 0 GPS Already Present.)
11+
0x011a Image XResolution Rational 1 72/1
12+
0x011b Image YResolution Rational 1 72/1
13+
0x0128 Image ResolutionUnit Short 1 2
14+
0x0132 Image DateTime Ascii 20 2012:11:22 12:34:56
15+
0x0213 Image YCbCrPositioning Short 1 1
16+
0x8769 Image ExifTag Long 1 134
17+
0x9000 Photo ExifVersion Undefined 4 48 50 49 48
18+
0x9003 Photo DateTimeOriginal Ascii 20 2012:11:22 12:34:56
19+
0x9004 Photo DateTimeDigitized Ascii 20 2012:11:22 12:34:56
20+
0x9101 Photo ComponentsConfiguration Undefined 4 1 2 3 0
21+
0xa000 Photo FlashpixVersion Undefined 4 48 49 48 48
22+
0xa001 Photo ColorSpace Short 1 65535
23+
0xa002 Photo PixelXDimension Long 1 64
24+
0xa003 Photo PixelYDimension Long 1 64
25+
0x8825 Image GPSTag Long 1 276
26+
0x0000 GPSInfo GPSVersionID Byte 4 2 2 0 0
27+
0x0001 GPSInfo GPSLatitudeRef Ascii 2 N
28+
0x0002 GPSInfo GPSLatitude Rational 3 47/1 25/1 16449600/1000000
29+
0x0003 GPSInfo GPSLongitudeRef Ascii 2 E
30+
0x0004 GPSInfo GPSLongitude Rational 3 10/1 59/1 6888000/1000000
31+
0x0005 GPSInfo GPSAltitudeRef Byte 1 0
32+
0x0006 GPSInfo GPSAltitude Rational 1 2959867/1000
33+
0x0007 GPSInfo GPSTimeStamp Rational 3 12/1 34/1 56/1
34+
0x0012 GPSInfo GPSMapDatum Ascii 7 WGS-84
35+
0x001d GPSInfo GPSDateStamp Ascii 11 2012:11:22

0 commit comments

Comments
 (0)