troubleshooting Question

Loop each Second

Avatar of giania
giania asked on
28 Comments6 Solutions418 ViewsLast Modified:

I'm trying to write a piece of code that will loop every second over a defined time range. I know how to get the time in seconds since 1/1/70 from the help pages but I dont know how to get it to loop every second for say, 5 seconds. If I can get it to print the time every second over 5 seconds I can incorporate it into my main code which will allow a user to ramp the power dissipated in a light bulb over a defined range in a defined time.

Any ideas???

here is the code for displaying the time in seconds since 1/1/70;

#include <time.h>
#include <stdio.h>

void main()
time_t ltime;

time( &ltime );
printf( "Time in seconds since UTC 1/1/70:\t%ld\n", ltime );

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 6 Answers and 28 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 6 Answers and 28 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros