Skip to content

Commit

Permalink
Fix shell timezone bugs
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.code.sf.net/p/efi-shell/code/trunk/Shell@47 98faeb64-521c-4ab6-bae1-df9f193a316f
  • Loading branch information
niruiyu authored and niruiyu committed Feb 16, 2011
1 parent 40fd2a9 commit 00d10d9
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 137 deletions.
54 changes: 21 additions & 33 deletions time/time.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*++
Copyright (c) 2005 - 2007, Intel Corporation
Copyright (c) 2005 - 2011, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
Expand Down Expand Up @@ -96,8 +96,7 @@ Routine Description:
UINTN Offset;
UINTN Data;
EFI_HII_HANDLE HiiHandle;
INTN nValue;
UINTN uValueSize;
INT16 nValue;
CHAR16 wchSign;

SHELL_VAR_CHECK_CODE RetCode;
Expand Down Expand Up @@ -188,38 +187,27 @@ Routine Description:
Status = RT->GetTime (&Time, NULL);

if (!EFI_ERROR (Status)) {
Status = RT->GetVariable (
L"TimeZone",
&gEfiGenericVariableGuid,
NULL,
&uValueSize,
&nValue
);
if (!EFI_ERROR (Status) || EFI_NOT_FOUND == Status) {
if (EFI_NOT_FOUND == Status) {
nValue = 0;
}

if (nValue < 0) {
nValue = -nValue;
wchSign = L'-';
}

PrintToken (
STRING_TOKEN (STR_TIME_THREE_VARS),
HiiHandle,
(UINTN) Time.Hour,
(UINTN) Time.Minute,
(UINTN) Time.Second,
wchSign,
nValue / 100,
nValue % 100
);
Status = EFI_SUCCESS;
goto Done;
if (Time.TimeZone < 0) {
nValue = -Time.TimeZone;
} else {
nValue = Time.TimeZone;
wchSign = L'-';
}
}

PrintToken (
STRING_TOKEN (STR_TIME_THREE_VARS),
HiiHandle,
(UINTN) Time.Hour,
(UINTN) Time.Minute,
(UINTN) Time.Second,
wchSign,
nValue / 60,
nValue % 60
);
Status = EFI_SUCCESS;
goto Done;
}

PrintToken (STRING_TOKEN (STR_TIME_CLOCK_NOT_FUNC), HiiHandle, L"time");
goto Done;
}
Expand Down
Binary file modified tzone/TZoneStrings.uni
Binary file not shown.
Loading

0 comments on commit 00d10d9

Please sign in to comment.