Message ID | 1510042151-32569-1-git-send-email-ivan.hu@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | uefi: uefirttime: fix the time zone to exact value | expand |
On 2017-11-07 04:09 PM, Ivan Hu wrote: > UEFI spec defined the time zone value for -1440 to 1440 and 2047(unspecified > time zone). Using timezone 1 is allowed by UEFI spec, however value 1 is not > exact value on earth. Some firmware will check the exact timezone value on > earth, so the test will fail. Modify the timezone value test with 0 and 2047 > for testing. > > Signed-off-by: Ivan Hu <ivan.hu@canonical.com> > --- > src/uefi/uefirttime/uefirttime.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c > index 7998f7f..d6df9d1 100644 > --- a/src/uefi/uefirttime/uefirttime.c > +++ b/src/uefi/uefirttime/uefirttime.c > @@ -321,7 +321,8 @@ static int uefirttime_test4(fwts_framework *fw) > if (time.TimeZone != 0) > time.TimeZone = 0; > else > - time.TimeZone = 1; > + /* Unspecified timezone, local time */ > + time.TimeZone = 2047; > > settime.Time = &time; > settime.status = &status; > @@ -370,7 +371,7 @@ static int uefirttime_test4(fwts_framework *fw) > return FWTS_ERROR; > } > > - if (!((oldtime.TimeZone == 0) && (newtime.TimeZone == 1)) && > + if (!((oldtime.TimeZone == 0) && (newtime.TimeZone == 2047)) && > !((oldtime.TimeZone != 0) && (newtime.TimeZone == 0))) { > fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTimeTimezone", > "Failed to set timezone with UEFI runtime service."); > Acked-by: Alex Hung <alex.hung@canonical.com>
On 07/11/17 08:09, Ivan Hu wrote: > UEFI spec defined the time zone value for -1440 to 1440 and 2047(unspecified > time zone). Using timezone 1 is allowed by UEFI spec, however value 1 is not > exact value on earth. Some firmware will check the exact timezone value on > earth, so the test will fail. Modify the timezone value test with 0 and 2047 > for testing. > > Signed-off-by: Ivan Hu <ivan.hu@canonical.com> > --- > src/uefi/uefirttime/uefirttime.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c > index 7998f7f..d6df9d1 100644 > --- a/src/uefi/uefirttime/uefirttime.c > +++ b/src/uefi/uefirttime/uefirttime.c > @@ -321,7 +321,8 @@ static int uefirttime_test4(fwts_framework *fw) > if (time.TimeZone != 0) > time.TimeZone = 0; > else > - time.TimeZone = 1; > + /* Unspecified timezone, local time */ > + time.TimeZone = 2047; > > settime.Time = &time; > settime.status = &status; > @@ -370,7 +371,7 @@ static int uefirttime_test4(fwts_framework *fw) > return FWTS_ERROR; > } > > - if (!((oldtime.TimeZone == 0) && (newtime.TimeZone == 1)) && > + if (!((oldtime.TimeZone == 0) && (newtime.TimeZone == 2047)) && > !((oldtime.TimeZone != 0) && (newtime.TimeZone == 0))) { > fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTimeTimezone", > "Failed to set timezone with UEFI runtime service."); > Those are interesting corner cases. Acked-by: Colin Ian King <colin.king@canonical.com>
diff --git a/src/uefi/uefirttime/uefirttime.c b/src/uefi/uefirttime/uefirttime.c index 7998f7f..d6df9d1 100644 --- a/src/uefi/uefirttime/uefirttime.c +++ b/src/uefi/uefirttime/uefirttime.c @@ -321,7 +321,8 @@ static int uefirttime_test4(fwts_framework *fw) if (time.TimeZone != 0) time.TimeZone = 0; else - time.TimeZone = 1; + /* Unspecified timezone, local time */ + time.TimeZone = 2047; settime.Time = &time; settime.status = &status; @@ -370,7 +371,7 @@ static int uefirttime_test4(fwts_framework *fw) return FWTS_ERROR; } - if (!((oldtime.TimeZone == 0) && (newtime.TimeZone == 1)) && + if (!((oldtime.TimeZone == 0) && (newtime.TimeZone == 2047)) && !((oldtime.TimeZone != 0) && (newtime.TimeZone == 0))) { fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetTimeTimezone", "Failed to set timezone with UEFI runtime service.");
UEFI spec defined the time zone value for -1440 to 1440 and 2047(unspecified time zone). Using timezone 1 is allowed by UEFI spec, however value 1 is not exact value on earth. Some firmware will check the exact timezone value on earth, so the test will fail. Modify the timezone value test with 0 and 2047 for testing. Signed-off-by: Ivan Hu <ivan.hu@canonical.com> --- src/uefi/uefirttime/uefirttime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)