Re: Time conversion in C
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Mon, 06 Nov 2006 19:20:25 -0500
moni wrote:
This is all in C:
So why ask in a C# group ?
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.
This is not the right forum.
But you can stuff your integer values into a struct tm
and convert it to a time_t with the mktime function.
Arne
.
- References:
- Time conversion in C
- From: moni
- Time conversion in C
- Prev by Date: Re: What am I missing about comparing Dates here?
- Next by Date: Re: Adding a copy of a row in a DataGridView
- Previous by thread: Re: Time conversion in C
- Next by thread: Re: Time conversion in C
- Index(es):
Relevant Pages
|