Get the system time as seconds elapsed since midnight, January 1, 1970. */ INTN time( INTN *timer )
| 76 | // INTN *timer |
| 77 | // ) |
| 78 | time_t time (time_t *timer) |
| 79 | { |
| 80 | EFI_TIME Time; |
| 81 | UINTN Year; |
| 82 | |
| 83 | // |
| 84 | // Get the current time and date information |
| 85 | // |
| 86 | gRT->GetTime (&Time, NULL); |
| 87 | |
| 88 | // |
| 89 | // Years Handling |
| 90 | // UTime should now be set to 00:00:00 on Jan 1 of the current year. |
| 91 | // |
| 92 | for (Year = 1970, *timer = 0; Year != Time.Year; Year++) { |
| 93 | *timer = *timer + (time_t)(CumulativeDays[IsLeap(Year)][13] * SECSPERDAY); |
| 94 | } |
| 95 | |
| 96 | // |
| 97 | // Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment |
| 98 | // |
| 99 | *timer = *timer + |
| 100 | (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) + |
| 101 | (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * SECSPERDAY) + |
| 102 | (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) + |
| 103 | (time_t)(Time.Hour * SECSPERHOUR) + |
| 104 | (time_t)(Time.Minute * 60) + |
| 105 | (time_t)Time.Second; |
| 106 | |
| 107 | return *timer; |
| 108 | } |
| 109 | |
| 110 | // |
| 111 | // Convert a time value from type time_t to struct tm. |
no outgoing calls
no test coverage detected