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

C / C++ / MFC

 
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 
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 
I've set tm_isdst to 0.
However to convert the string into time_t I've used these functions (insted of mktime):

void FileTimeToUnixTime(LPFILETIME pft, time_t *t)
{
// Note that LONGLONG is a 64-bit value
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);
}

the datetime string is parsed and a SYSTEMTIME struct is filled. Then SystemTimeToUnixTime() is used to convert from SYSTEMTIME to time_t.

---------------------------------------------------
To revert time_t to a string I've used these functions :

void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;

ll = Int32x32To64(t, 10000000) + 116444736000000000;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}

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

UnixTimeToFileTime(t, &ft);
FileTimeToSystemTime(&ft, pst);
}

time_t is converted to a SYSTEMTIME by UnixTimeToSystemTime(). Then I've build a datetime string using SYSTEMTIME members.



These functions use internally FileTimeToSystemTime() and SystemTimeToFileTime() and no other OS functions.
I've thought that these two functions only convert SYSTEMTIME to FILETIME and vice versa without taking into account time zone and day light saving ...
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 
QuestionDatabase Pin
anjita3-Aug-06 1:53
anjita3-Aug-06 1:53 
AnswerRe: Database Pin
Hamid_RT3-Aug-06 1:58
Hamid_RT3-Aug-06 1:58 
AnswerRe: Database Pin
Bravoone_20063-Aug-06 2:13
Bravoone_20063-Aug-06 2:13 
AnswerRe: Database Pin
David Crow3-Aug-06 2:34
David Crow3-Aug-06 2:34 
QuestionAGAIN !!! Sory but i dont find my thread ! to write ! Pin
Bravoone_20063-Aug-06 1:44
Bravoone_20063-Aug-06 1:44 
AnswerRe: AGAIN !!! Sory but i dont find my thread ! to write ! Pin
Viorel.3-Aug-06 2:09
Viorel.3-Aug-06 2:09 

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.