File: 90_leap_year_bug.dpatch

package info (click to toggle)
gpsd 2.33-4etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 2,904 kB
  • ctags: 1,861
  • sloc: ansic: 14,508; sh: 9,172; xml: 2,657; python: 1,446; makefile: 334; cpp: 120; perl: 22
file content (19 lines) | stat: -rw-r--r-- 666 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /bin/sh /usr/share/dpatch/dpatch-run
## 90_leap_year_bug.dpatch by Bernd Zeimetz <bzed@debian.org>
##
## DP:  Leap year bugfix, make gpsd work again.

@DPATCH@
diff -urNad gpsd-2.33~/gpsutils.c gpsd-2.33/gpsutils.c
--- gpsd-2.33~/gpsutils.c	2006-02-27 09:54:35.000000000 +0100
+++ gpsd-2.33/gpsutils.c	2008-01-23 16:31:48.000000000 +0100
@@ -82,6 +82,9 @@
     result += (year - 1968) / 4;
     result -= (year - 1900) / 100;
     result += (year - 1600) / 400;
+    if ((year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0) &&
+	(t->tm_mon % MONTHSPERYEAR) < 2)
+	     result--;
     result += t->tm_mday - 1;
     result *= 24;
     result += t->tm_hour;