summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2017-02-17 12:47:09 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-17 15:08:38 -0800
commit0cf4104dc60134f207a60906e83311af986e0ada (patch)
tree5e90ce52526bf31912338985247a761712e36f97 /core
parentc5b9cfcaf655bd5af3bf57277b3591505d84e1cb (diff)
downloadsubsurface-0cf4104dc60134f207a60906e83311af986e0ada.tar.gz
Handle negative dates (before the epoch) better
The Qt model sorting for the dive date was using a unsigned number, which doesn't work for dates before 1970. Also, the dive date parsing got the year 1900 wrong. Not that we really care, because other parts of date handling will screw up with any date before the year 1904. So if you claim to be diving before 1904, you get basically random behavior. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core')
-rw-r--r--core/time.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/time.c b/core/time.c
index 9992658b6..cbf7d2e2a 100644
--- a/core/time.c
+++ b/core/time.c
@@ -108,7 +108,7 @@ timestamp_t utc_mktime(struct tm *tm)
/* First normalize relative to 1900 */
if (year < 50)
year += 100;
- else if (year > 1900)
+ else if (year >= 1900)
year -= 1900;
if (year < 0 || year > 129) /* algo only works for 1900-2099 */