41 if (*String == L
'-') {
56 for ( ; String !=
NULL && *String != CHAR_NULL; String++) {
57 if (*String == Char) {
95 CHAR16 *DateStringCopy;
103 Status =
gRT->GetTime (&TheTime,
NULL);
104 if (EFI_ERROR (Status)) {
109 DateStringCopy =
NULL;
111 if (DateStringCopy ==
NULL) {
115 Walker = DateStringCopy;
117 TheTime.Month = 0xFF;
119 TheTime.Year = 0xFFFF;
121 Walker1 =
StrStr (Walker, L
"/");
122 if ((Walker1 !=
NULL) && (*Walker1 == L
'/')) {
123 *Walker1 = CHAR_NULL;
127 if (Walker1 !=
NULL) {
128 Walker = Walker1 + 1;
132 if ((Walker1 !=
NULL) && (*Walker1 == L
'/')) {
133 *Walker1 = CHAR_NULL;
136 if ((Walker !=
NULL) && (Walker[0] != CHAR_NULL)) {
138 if (Walker1 !=
NULL) {
139 Walker = Walker1 + 1;
143 if ((Walker1 !=
NULL) && (*Walker1 == L
'/')) {
144 *Walker1 = CHAR_NULL;
147 if ((Walker !=
NULL) && (Walker[0] != CHAR_NULL)) {
152 if (TheTime.Year < 100) {
153 if (TheTime.Year >= 98) {
154 TheTime.Year = (UINT16)(1900 + TheTime.Year);
156 TheTime.Year = (UINT16)(2000 + TheTime.Year);
160 Status =
gRT->SetTime (&TheTime);
162 if (!EFI_ERROR (Status)) {
185 CHAR16 *ProblemParam;
187 CONST CHAR16 *Param1;
202 if (EFI_ERROR (Status)) {
203 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
228 Status =
gRT->GetTime (&TheTime,
NULL);
229 if (EFI_ERROR (Status)) {
249 if (
PcdGet8 (PcdShellSupportLevel) == 2) {
257 if (Param1 ==
NULL) {
280 return (ShellStatus);
318 CHAR16 *TimeStringCopy;
326 if ((Daylight != 0xFF) && ((Daylight & (EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT)) != Daylight)) {
330 Status =
gRT->GetTime (&TheTime,
NULL);
331 if (EFI_ERROR (Status)) {
336 if (TimeString !=
NULL) {
337 TimeStringCopy =
NULL;
339 Walker1 = TimeStringCopy;
341 TheTime.Minute = 0xFF;
344 if ((Walker2 !=
NULL) && (*Walker2 == L
':')) {
345 *Walker2 = CHAR_NULL;
349 if (Walker2 !=
NULL) {
350 Walker1 = Walker2 + 1;
354 if ((Walker2 !=
NULL) && (*Walker2 == L
':')) {
355 *Walker2 = CHAR_NULL;
356 TheTime.Second = (UINT8)0;
357 }
else if (Walker2 ==
NULL) {
358 TheTime.Second = (UINT8)0;
361 if ((Walker1 !=
NULL) && (Walker1[0] != CHAR_NULL)) {
363 if (Walker2 !=
NULL) {
364 Walker1 = Walker2 + 1;
365 if ((Walker1 !=
NULL) && (Walker1[0] != CHAR_NULL)) {
371 SHELL_FREE_NON_NULL (TimeStringCopy);
374 if ((Tz >= -1440) && (Tz <= 1440)) {
383 TheTime.TimeZone = -Tz;
385 TheTime.TimeZone = Tz;
388 if (Daylight != 0xFF) {
389 TheTime.Daylight = Daylight;
392 Status =
gRT->SetTime (&TheTime);
394 if (!EFI_ERROR (Status)) {
417 CHAR16 *ProblemParam;
421 CONST CHAR16 *TempLocation;
439 if (
PcdGet8 (PcdShellSupportLevel) == 2) {
442 ASSERT (
PcdGet8 (PcdShellSupportLevel) == 3);
446 if (EFI_ERROR (Status)) {
447 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
458 Status =
gRT->GetTime (&TheTime,
NULL);
459 if (EFI_ERROR (Status)) {
483 TzMinutes = (
ABS (TheTime.TimeZone)) % 60;
492 gShellLevel2HiiHandle,
496 (TheTime.TimeZone > 0 ? L
"-" : L
"+"),
497 ((
ABS (TheTime.TimeZone)) / 60),
506 gShellLevel2HiiHandle,
521 gShellLevel2HiiHandle,
527 TzMinutes = (
ABS (TheTime.TimeZone)) % 60;
533 gShellLevel2HiiHandle,
537 (TheTime.TimeZone > 0 ? L
"-" : L
"+"),
538 ((
ABS (TheTime.TimeZone)) / 60),
543 switch (TheTime.Daylight) {
547 case EFI_TIME_ADJUST_DAYLIGHT:
550 case EFI_TIME_IN_DAYLIGHT:
553 case EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT:
557 ShellPrintHiiEx (-1, -1,
NULL,
STRING_TOKEN (STR_GEN_UEFI_FUNC_ERROR), gShellLevel2HiiHandle, L
"time", L
"gRT->GetTime", L
"TheTime.Daylight", TheTime.Daylight);
560 if (
PcdGet8 (PcdShellSupportLevel) == 2) {
568 if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)TempLocation, L
"_local") == 0) {
570 }
else if (TempLocation[0] == L
'-') {
582 if (TempLocation[0] == L
'+') {
608 if (TempLocation !=
NULL) {
615 if (TempLocation[0] ==
'-') {
619 if ((Daylight != 0) && (Daylight != 1) && (Daylight != 3)) {
650 return (ShellStatus);
655 EFI_STRING_ID StringId;
721 IN CONST CHAR16 *TimeZoneString
726 CHAR16 *TimeZoneCopy;
731 if (TimeZoneString ==
NULL) {
735 if (gUnicodeCollation->StriColl (gUnicodeCollation, (CHAR16 *)TimeZoneString, L
"_local") == 0) {
736 Status =
gRT->GetTime (&TheTime,
NULL);
737 if (EFI_ERROR (Status)) {
743 Status =
gRT->SetTime (&TheTime);
744 if (!EFI_ERROR (Status)) {
755 Status =
gRT->GetTime (&TheTime,
NULL);
756 if (EFI_ERROR (Status)) {
763 if (TimeZoneCopy ==
NULL) {
767 Walker = TimeZoneCopy;
768 Walker2 =
StrStr (Walker, L
":");
769 if ((Walker2 !=
NULL) && (*Walker2 == L
':')) {
770 *Walker2 = CHAR_NULL;
773 if (*Walker == L
'-') {
779 if (Walker2 !=
NULL) {
780 Walker = Walker2 + 1;
783 if ((Walker !=
NULL) && (Walker[0] != CHAR_NULL)) {
784 if (TheTime.TimeZone < 0) {
785 TheTime.TimeZone = (INT16)(TheTime.TimeZone - (UINT8)
ShellStrToUintn (Walker));
787 TheTime.TimeZone = (INT16)(TheTime.TimeZone + (UINT8)
ShellStrToUintn (Walker));
791 Status = EFI_INVALID_PARAMETER;
794 ; LoopVar <
sizeof (TimeZoneList) /
sizeof (TimeZoneList[0])
798 if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
799 Status =
gRT->SetTime (&TheTime);
806 if (!EFI_ERROR (Status)) {
831 CHAR16 *ProblemParam;
850 if (
PcdGet8 (PcdShellSupportLevel) == 2) {
853 ASSERT (
PcdGet8 (PcdShellSupportLevel) == 3);
857 if (EFI_ERROR (Status)) {
858 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
879 ASSERT (
PcdGet8 (PcdShellSupportLevel) == 3);
899 ; LoopVar <
sizeof (TimeZoneList) /
sizeof (TimeZoneList[0])
909 Status =
gRT->GetTime (&TheTime,
NULL);
910 if (EFI_ERROR (Status)) {
918 ; LoopVar <
sizeof (TimeZoneList) /
sizeof (TimeZoneList[0])
922 if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
932 TzMinutes = (
ABS (TheTime.TimeZone)) % 60;
939 gShellLevel2HiiHandle,
940 (TheTime.TimeZone > 0 ? L
"-" : L
"+"),
941 (
ABS (TheTime.TimeZone)) / 60,
955 TzMinutes = (
ABS (TheTime.TimeZone)) % 60;
962 gShellLevel2HiiHandle,
963 (TheTime.TimeZone > 0 ? L
"-" : L
"+"),
964 (
ABS (TheTime.TimeZone)) / 60,
982 if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) {
1005 return (ShellStatus);
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_RUNTIME_SERVICES * gRT
#define ARRAY_SIZE(Array)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
#define PcdGet8(TokenName)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
@ TypeTimeValue
A flag that has a time value following it (IE "-a -5:00").
@ TypeFlag
A flag that is present or not present only (IE "-a").
BOOLEAN EFIAPI ShellIsDecimalDigitCharacter(IN CHAR16 Char)
SHELL_PARAM_ITEM SfoParamList[]
Helper structure for -sfo only (besides -? and -b)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
EFI_STATUS EFIAPI ShellCommandLineParseEx(IN CONST SHELL_PARAM_ITEM *CheckList, OUT LIST_ENTRY **CheckPackage, OUT CHAR16 **ProblemParam OPTIONAL, IN BOOLEAN AutoPageBreak, IN BOOLEAN AlwaysAllowNumbers)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
SHELL_STATUS EFIAPI ShellCommandRunTime(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS EFIAPI ShellCommandRunTimeZone(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS CheckAndSetTime(IN CONST CHAR16 *TimeString, IN CONST INT16 Tz, IN CONST UINT8 Daylight)
SHELL_STATUS CheckAndSetTimeZone(IN CONST CHAR16 *TimeZoneString)
SHELL_STATUS EFIAPI ShellCommandRunDate(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS CheckAndSetDate(IN CONST CHAR16 *DateString)
BOOLEAN InternalIsTimeLikeString(IN CONST CHAR16 *String, IN CONST CHAR16 Char, IN CONST UINTN Min, IN CONST UINTN Max, IN CONST BOOLEAN MinusOk)
#define EFI_UNSPECIFIED_TIMEZONE