[haiku-3rdparty-dev] Re: The "When" attribute in the BMessage

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Tue, 08 Sep 2009 11:01:10 +0200

Hi,

On 2009-09-08 at 06:10:15 [+0200], Yashasvi A.C. <yashasviac@xxxxxxxxx> 
wrote:
> Once I capture a BMessage in the message_print_hook() function and look 
> at each message that goes through, I also look into the "when" 
> attribute/property which I assume is the timestamp variable. Its an Int64 
> variable and on printing it out to the console, the number itself does 
> not make any sense (although I can see it increasing with each second). 
> Is there any attribute in the BMessage that reflects the actual time of 
> the creation of the BMessage (for example, 15390009092009 to say the 
> BMessage was created at 3:39pm on 9th Sept 2009? If not, I would assume I 
> would have to pull the system date itself then :).

It's the time in microseconds that has passed since the system was booted. 
To convert it, it seems you just have to use system_time() and 
real_time_clock[_usecs]() (from OS.h) to match up these times. For example, 
real_time_clock_usecs() - system_time() is the time in microseconds when 
the system has bootet (in microseconds since January 1st, 1970). You can 
use functions from time.h to get human readable output.

Best regards,
-Stephan

Other related posts: