Jump to content

Need help with time variables

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Fledgling Pidgeon

Fledgling Pidgeon

    Newbie

  • Members
  • Pip
  • 3 posts
I need to write a program that reads two times from the console and then returns the difference between them, so that I can apply the concept to other situations. The issue is that I don't understand the time.h library, I don't actually know C, and I can't for the life of me parse an array with hh:mm:ss into three different arrays. If I could do that, I could then turn all of it into integers and go from there, then just print the results. Any help? Thank you very much in advance!

#2
breimer273

breimer273

    Newbie

  • Members
  • PipPip
  • 16 posts
I'm not really sure what you are asking in this question. This link talks about the time.h library: ctime (time.h) - C++ Reference

In C time is usually represented as an integer (of type time_t) that represents the number of seconds that have passed since 00:00 January 1, 1970. I hope this helps steer you in the right direction.

#3
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
You can convert strings to integers with atoi() function, also take a look at sprintf function.
A conclusion is where you got tired of thinking.
#define class struct    // All is public.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users