To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 3273
3272  |  3274
Subject: 
Re: TIME STAMP for a LNP distributed robot
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Wed, 7 May 2003 16:04:49 GMT
Viewed: 
3302 times
  
Hi,

The sys_time variable is the basic timekeeper for BrickOS.  It is
a 32-bit integer that is incremented every millisecond by the
kernel.  In older versions of the kernel you could access the
variable directly, however, in 0.2.6.10 and later you need
to use the get_system_up_time() function to access the current
value.  You shouldn't change the timer value because
many kernel services rely on it.  A sudden jump forward or
backwards in the timer value might have undesirable
consequences.  You could, however, keep a seperate variable
that you always add to the timer value that gives your application
the current time.  Here's an example:

long time_adust = 0;

time_t get_time()
  {
  return get_system_up_time() + time_adust;
  }

void set_time(time_t new_time)
  {
  time_adjust = new_time - get_system_up_time();
  }

HTH,

Mark










"CarlosLuis Rendón M." <crendon@ieee.org> wrote in message
news:HEIv72.t07@lugnet.com...
Hi, I'd like to make a basic implementation of a time stamp on a • distributed
schame, using Lamport's algorithm. It states basically that when a node
receives a message, it get the time stamp that's contained on it, and
compares with it's own, if the received one is grater than the brick's • own,
then it replaces it with the one of the message. If not, then it just
ignores it. This gives us the chance to have a global "sequence of events
(unequivocal).

Well, what I'd like to find out, is in which part of the kernel is handled
the time of each brick, and if is writeable from a user program. Any other
comments/suggestions will be welcomed.


Best Regards,
CarlosLuis Rendon M.





Message has 1 Reply:
  Re: TIME STAMP for a LNP distributed robot
 
BTW, make sure you include: #include <time.h> Otherwise, get_system_up_time() will only return 16 bits! Mark (22 years ago, 7-May-03, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  TIME STAMP for a LNP distributed robot
 
Hi, I'd like to make a basic implementation of a time stamp on a distributed schame, using Lamport's algorithm. It states basically that when a node receives a message, it get the time stamp that's contained on it, and compares with it's own, if the (...) (22 years ago, 7-May-03, to lugnet.robotics.rcx.legos)

4 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR