[openbeos] is system_time(); an expensive call?

  • From: "Bruno van Dooren" <bruno_van_dooren@xxxxxxxxxxx>
  • To: <openbeos@xxxxxxxxxxxxx>
  • Date: Fri, 16 May 2003 20:04:03 +0200

Hi,

i am currently writing the new PS2 port kernel driver for the keyboard and 
mouse input server devices.
i did some research, and for the mouse sends multi byte packets that to the ps2 
port.
my driver just has to read those bytes, and format them into a mouse data 
packet.

the only problem is that there is no error handling or sequencing in that 
protocol. this means
that if i get a sequence of bytes, i have to assume that every 3d byte is the 
first byte of a data packet.
this is not a problem in itself, but if one byte would get lost somehow, this 
would mess up all future mouse data
packets.

the only thing i can do is to check the difference in time between different 
bytes.
it is logical that the time differences between bytes from the same packet are 
smaller then
the difference in time between bytes from different packets.

now i was wondering: is the system_time function an expensive function to use?
should i use another funtion or a timer interrupt to increase an internal tick 
counter?

kind regards,
    Bruno.

Other related posts: