Exemplo n.º 1
0
time_t
time(time_t *tloc)
{
	struct ssc_time time;

	ssc((u_int64_t) &time, 0, 0, 0, SSC_GET_RTC);

	return *tloc = EfiTimeToUnixTime(&time);
}
Exemplo n.º 2
0
int
EFI_GetTimeOfDay(
	OUT struct timeval *tp,
	OUT struct timezone *tzp
	)
{
	EFI_TIME				EfiTime;
	EFI_TIME_CAPABILITIES	Capabilities;
	EFI_STATUS				Status;

	/*
	//  Get time from EFI
	*/

	Status = RS->GetTime( &EfiTime, &Capabilities );
	if (EFI_ERROR(Status))
		return (-1);

	/*
	//  Convert to UNIX time (ie seconds since the epoch
	*/

	tp->tv_sec  = EfiTimeToUnixTime( &EfiTime );
	tp->tv_usec = 0; /* EfiTime.Nanosecond * 1000; */

	/*
	//  Do something with the timezone if needed
	*/

	if (tzp) {
		tzp->tz_minuteswest =
			EfiTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE ? 0 : EfiTime.TimeZone;
		/*
		//  This isn't quit right since it doesn't deal with EFI_TIME_IN_DAYLIGHT
		*/
		tzp->tz_dsttime =
			EfiTime.Daylight & EFI_TIME_ADJUST_DAYLIGHT ? 1 : 0;
	}

	return (0);
}