Subject:
|
Re: Re:Re:system time
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Tue, 18 Mar 1997 11:42:32 GMT
|
Original-From:
|
Pandit Panburana <pdp@#spamcake#ix.netcom.com>
|
Viewed:
|
1538 times
|
| |
| |
Hi Joe,
From the code below I see that there are a few things
that I see that may be a bit incorrect.
In the main() function, I see that there is a statement
"while(1);". This statement is a complete C statement
which will loop forever with out any body of work done inside.
Secondly, after the "while(1);", there is the statement that
will start the process as you like to do. I am not fully
understan the intention but my guesse is that you want to
start a process once for the time keep track (not in side
the while(1) loop i.e. you would not want to keep creating
a process forever). Continue creating processes may
cause run time error due to board runs out of the resouces
for processes.
Lastly, the time keeping process that you are creating
needs to be in the while(1) loop to continue keep track
of time.
My correct of code (without knowing or understanding
fully of your intention) is below. It seems that there
might be a better alternative in implementing the
the program that you want.
void time (int d)
{
while (1) {
d += 1;
}
}
main (void)
{
int d;
/*
* Get the time at start and start the process
* to keep update the time.
*/
start_process(time(d), 1, 50);
}
For the "casting" question early on, I saw that there is a mail from
some one that explains "casting". The mail did a nice work to
explain "casting" and the things that you need to be aware of
when casting from "float" to "int". Information may loss along
the way. My personal opionion on "casting" is to avoid if you
can, good planing can help a lot and it makes code more
maintainable.
Good luck with you attempt...
Regards,
-Pandit
----------
> From: Joe Martin <Joema@mpx.com.au>
> To: handyboard@media.mit.edu
> Subject: Re:Re:system time
> Date: Tuesday, March 18, 1997 5:54 AM
>
> I've posted the wrong code. Try this one:
>
> void time(int d)
> {d+=1;}
>
> void main()
> {int d;
> while(1);
> start_process(time(d), 1, 50);
> }
>
> Joe
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|