Skip to contentSkip to conversation

rtc: skip year-2038 overflow check in case time_t is 32bit only

PATCH In review Gerd Hoffmann 2 participants 3 messages Jan 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: skip year-2038 overflow check in case time_t is 32bit only

---
 tests/rtc-test.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tests/rtc-test.c +4 -0
index 02edbf5..548200a 100644
@@ -201,6 +201,10 @@ static void set_year_20xx(void)
     g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
     g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
 
+    if (sizeof(time_t) == 32) {
+        return;
+    }
+
     /* Set a date in 2080 to ensure there is no year-2038 overflow.  */
     cmos_write(RTC_REG_A, 0x76);
     cmos_write(RTC_YEAR, 0x80);
Signature · 1 line
1.7.1
#1 lore raw

Am 04.01.2013 10:43, schrieb Gerd Hoffmann:

Quoted 10 lines
---
 tests/rtc-test.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tests/rtc-test.c +0 -0
index 02edbf5..548200a 100644

tests/rtc-test.c static void set_year_20xx(void) · line 204

Quoted 4 lines
tests/rtc-test.c +1 -0
@@ -201,6 +201,10 @@ static void set_year_20xx(void)
     g_assert_cmpint(cmos_read(RTC_YEAR), ==, 0x11);
     g_assert_cmpint(cmos_read(RTC_CENTURY), ==, 0x20);
 
+    if (sizeof(time_t) == 32) {

You sure that shouldn't be 4 then?

Andreas

Quoted 6 lines
tests/rtc-test.c +3 -0
+        return;
+    }
+
     /* Set a date in 2080 to ensure there is no year-2038 overflow.  */
     cmos_write(RTC_REG_A, 0x76);
     cmos_write(RTC_YEAR, 0x80);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw

Hi,

Quoted 3 lines
Quoted 1 line

+ if (sizeof(time_t) == 32) {

You sure that shouldn't be 4 then?

Oops, yes. Should have waited for buildbot results ...

cheers,
Gerd