-
January 20th, 2010, 09:53 PM
#1
Use modulus operator to convert time
I need to convert hours into weeks, days, and hours.
My professor was hinting that there might be a way to
do this using the modulus operator but I can't seem to think of a way
that its possible. Can anyone help?
thanks!
-
January 20th, 2010, 10:53 PM
#2
Re: Use modulus operator to convert time
Hi jhus00
modulus operator returns the remainder of the division. you already know this correct?
EDIT:
the first step is to define end goal of your program.
you can show us, either in real or psuedo code, or written statement, how you would define this end goal.
and don't forget to wrap your code inside [code] your code goes here[/code]
Last edited by potatoCode; January 20th, 2010 at 10:56 PM.
-
January 21st, 2010, 08:02 AM
#3
Re: Use modulus operator to convert time
Well, the time_t structures is seconds since Jan 1st, 1970 at midnight GMT. There are 60 seconds in a minute, so time % 60 will give you the current seconds. From there you should be able to figure it out.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|