Time conversion in C
- From: "moni" <mons.2110@xxxxxxxxx>
- Date: 6 Nov 2006 12:45:33 -0800
This is all in C:
I have 2 time values:
System time and an input from the user.
1) System time is in the form of seconds from 1/1/1970 calculated by
using
time_t secs;
SYSTEMTIME stime;
time(&secs);
2) The input from the user is in form hr:min:sec which is a string
value.
But the seperate values have been obtained by using
sscanf(storedTimeValue, "%d:%d:%d", &hour,&minutes,&seconds);
So now I have 3 integer values for hour,minutes and seconds.
3) I have a function which calculates the time difference between 2
time values,
but both these time values need to be seconds from 1/1/1970.
Is there any way by which,I could convert the user given time into time
in seconds from 1/1/1970,
so that I can get the difference between the system time and the user
given time.
.
- Follow-Ups:
- Re: Time conversion in C
- From: Mark Rae
- Re: Time conversion in C
- From: Arne Vajhøj
- Re: Time conversion in C
- From: Jon Skeet [C# MVP]
- Re: Time conversion in C
- Prev by Date: Re: Does Mono has everything
- Next by Date: Re: what user help formats are recommended?
- Previous by thread: Does Mono has everything
- Next by thread: Re: Time conversion in C
- Index(es):
Relevant Pages
|