Click here to Skip to main content
15,890,845 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Function with default arguments Pin
Nyarlatotep3-Aug-06 3:48
Nyarlatotep3-Aug-06 3:48 
GeneralRe: Function with default arguments Pin
Zac Howland3-Aug-06 3:53
Zac Howland3-Aug-06 3:53 
AnswerRe: Function with default arguments Pin
Gary R. Wheeler3-Aug-06 3:12
Gary R. Wheeler3-Aug-06 3:12 
AnswerRe: Function with default arguments Pin
Zac Howland3-Aug-06 3:43
Zac Howland3-Aug-06 3:43 
AnswerRe: Function with default arguments Pin
David Crow3-Aug-06 4:34
David Crow3-Aug-06 4:34 
GeneralRe: Function with default arguments Pin
Gary R. Wheeler3-Aug-06 5:30
Gary R. Wheeler3-Aug-06 5:30 
AnswerRe: Function with default arguments Pin
Hamid_RT4-Aug-06 6:50
Hamid_RT4-Aug-06 6:50 
QuestionTime zones [modified] Pin
Nyarlatotep3-Aug-06 3:00
Nyarlatotep3-Aug-06 3:00 
I've a weird problem making me crazy !!!

I've to read a sequence of dates from a text file and convert these dates into time_t.
I DON't want to take into account timezones and daylight savings, so the input date must be converted into the exact output date.
So, i've avoided mktime() to convert from tm (filled up with string dates from source) to time_t.
The next solution i've used was to convert a SYSTEMTIME to a time_t with these functions (based on similar functions, UnixTimeToSystemTime(), described in MSDN):


void FileTimeToUnixTime(LPFILETIME pft, time_t *t)
{
LONGLONG ll;

ll = pft->dwHighDateTime;
ll <<= 32;
ll |= pft->dwLowDateTime;

ll = ll - 116444736000000000;
*t = ll / 10000000;
}

void SystemTimeToUnixTime(LPSYSTEMTIME pst, time_t *t)
{
FILETIME ft;

SystemTimeToFileTime(pst, &ft);
FileTimeToUnixTime(&ft, t);
}

because I was sure that SystemTimeToFileTime() only converts to SYSTEMTIME format to FILETIME format without any other considerations like timezone or daylight saving.
In my PC these work well. When I've run the code in another PC, the resulting date is 1 hour back.
(it's very strange too, because that PC has the same date settings of mine).

I can't achive the result to obatin a time_t that reflect the same source date, without variations caused by currently timezone and daylight saving settings.


-- modified at 9:12 Thursday 3rd August, 2006
QuestionRe: Time zones Pin
David Crow4-Aug-06 3:11
David Crow4-Aug-06 3:11 
AnswerRe: Time zones Pin
Nyarlatotep4-Aug-06 3:19
Nyarlatotep4-Aug-06 3:19 
GeneralRe: Time zones Pin
David Crow4-Aug-06 4:07
David Crow4-Aug-06 4:07 
GeneralRe: Time zones [modified] Pin
Nyarlatotep4-Aug-06 4:19
Nyarlatotep4-Aug-06 4:19 
QuestionRe: Time zones Pin
David Crow4-Aug-06 4:30
David Crow4-Aug-06 4:30 
AnswerRe: Time zones Pin
Nyarlatotep4-Aug-06 4:41
Nyarlatotep4-Aug-06 4:41 
GeneralRe: Time zones Pin
David Crow4-Aug-06 5:47
David Crow4-Aug-06 5:47 
QuestionUntitled document/aplication?!!?! Pin
tanarnelinistit3-Aug-06 2:34
tanarnelinistit3-Aug-06 2:34 
AnswerRe: Untitled document/aplication?!!?! Pin
David Crow3-Aug-06 2:36
David Crow3-Aug-06 2:36 
AnswerRe: Untitled document/aplication?!!?! [modified] Pin
ovidiucucu3-Aug-06 2:57
ovidiucucu3-Aug-06 2:57 
GeneralRe: Untitled document/aplication?!!?! Pin
ovidiucucu3-Aug-06 3:21
ovidiucucu3-Aug-06 3:21 
Question[Message Deleted] Pin
Bravoone_20063-Aug-06 2:05
Bravoone_20063-Aug-06 2:05 
AnswerRe: IS WORKING BU ONLY LIKE THIS !!!!! BUT I DON T WANT THIS !!!! Pin
ovidiucucu3-Aug-06 2:17
ovidiucucu3-Aug-06 2:17 
AnswerRe: IS WORKING BU ONLY LIKE THIS !!!!! BUT I DON T WANT THIS !!!! Pin
Hamid_RT3-Aug-06 2:29
Hamid_RT3-Aug-06 2:29 
QuestionRe: IS WORKING BU ONLY LIKE THIS !!!!! BUT I DON T WANT THIS !!!! Pin
David Crow3-Aug-06 2:32
David Crow3-Aug-06 2:32 
AnswerRe: IS WORKING BU ONLY LIKE THIS !!!!! BUT I DON T WANT THIS !!!! Pin
toxcct3-Aug-06 2:34
toxcct3-Aug-06 2:34 
AnswerRe: IS WORKING BU ONLY LIKE THIS !!!!! BUT I DON T WANT THIS !!!! Pin
Viorel.3-Aug-06 2:37
Viorel.3-Aug-06 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.