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

login
register
mail settings
Submitter Gerd Hoffmann
Date Jan. 4, 2013, 9:43 a.m.
Message ID <1357292585-26746-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/209424/
State New
Headers show

Comments

Gerd Hoffmann - Jan. 4, 2013, 9:43 a.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 tests/rtc-test.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Andreas Färber - Jan. 4, 2013, 10:22 a.m.
Am 04.01.2013 10:43, schrieb Gerd Hoffmann:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  tests/rtc-test.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/tests/rtc-test.c b/tests/rtc-test.c
> index 02edbf5..548200a 100644
> --- a/tests/rtc-test.c
> +++ b/tests/rtc-test.c
> @@ -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

> +        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);
Gerd Hoffmann - Jan. 4, 2013, 12:47 p.m.
Hi,

>> +    if (sizeof(time_t) == 32) {
> 
> You sure that shouldn't be 4 then?

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

cheers,
  Gerd

Patch

diff --git a/tests/rtc-test.c b/tests/rtc-test.c
index 02edbf5..548200a 100644
--- a/tests/rtc-test.c
+++ b/tests/rtc-test.c
@@ -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);