Re: AbsoluteTime & IOHIKeyboard's _keyboardEventAction
Re: AbsoluteTime & IOHIKeyboard's _keyboardEventAction
- Subject: Re: AbsoluteTime & IOHIKeyboard's _keyboardEventAction
- From: Matt Burnett <email@hidden>
- Date: Tue, 25 Mar 2008 05:15:39 -0500
Im a bit tired, I must be doing something wrong, or function i borrowed meandmark.com isnt working. With the following code it tells me the even happened in the year 2090Code: double ConvertNanosecondsToDouble(Nanoseconds* nanosecondsValue) { double twoPower32 = 4294967296.0; double doubleValue; double upperHalf = (double)nanosecondsValue->hi; double lowerHalf = (double)nanosecondsValue->lo; doubleValue = (upperHalf * twoPower32) + lowerHalf; return doubleValue; }
AbsoluteTime keyTimeAbs = outputStruct->time; Nanoseconds keyTimeNano = AbsoluteToNanoseconds(keyTimeAbs); double keyTimeDouble = ConvertNanosecondsToDouble(&keyTimeNano); NSDate *keyTimeDate = [NSDate dateWithTimeIntervalSince1970:keyTimeDouble*1.0E-9]; NSLog(@"Key event date: %@",keyTimeDate);
2008-03-25 05:14:04.506 timeTest[5009:10b] Key event date: 2090-07-29 22:32:21 -0500
On Mar 25, 2008, at 4:49 AM, Brian Bergstrand wrote: AbsoluteTime is CPU specific. You have to use the mach clock_* functions to convert the interval to nano seconds. The epoch for the converted value will be the standard UNIX epoch (1970/1/1 00:00:00).
On Mar 25, 2008, at 11:35 AM, Matt Burnett wrote:
I have a KEXT which hooks in to IOHIKeyboard's _keyboardEventAction. One of the variables it provides me is time of the event in the form of AbsoluteTime. What date or event (power on?) is this value counting up from? Thanks.
Brian Bergstrand <http://www.bergstrand.org/brian/> PGP Key ID: 0xB6C7B6A2
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden