FILETIME to wxDateTime

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

FILETIME to wxDateTime

Post by cutecode »

how to convert FILETIME to wxDateTime?

Code: Select all

typedef struct _FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;
I need to get dates from certificate.
Using this code I get wring dates

Code: Select all

wxLongLong ll1(pCertContext->pCertInfo->NotBefore.dwHighDateTime, pCertContext->pCertInfo->NotBefore.dwLowDateTime);
wxDateTime dt1(ll1);
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: FILETIME to wxDateTime

Post by PB »

User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 427
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: FILETIME to wxDateTime

Post by cutecode »

Oh, thank you
I didn't know that my CSP defined this function on Linux too

Code: Select all

SYSTEMTIME st;
wxDateTime dt1;

FileTimeToSystemTime(&pCertContext->pCertInfo->NotBefore, &st);
dt1.Set(st.wDay, (wxDateTime::Month)(st.wMonth-1), st.wYear);
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: FILETIME to wxDateTime

Post by PB »

I have no idea what CSP is, but I assumed FILETIME is a MS Windows structure. I mean, not the generic 2-DWORDs struct but how to interpret its value...

But I have no knowledge of OSes outside Windows.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: FILETIME to wxDateTime

Post by ONEEYEMAN »

Hi,
In *nix world, you should call stat() family functions in order to get the file time.
I think for OSX its true as well.

Thank you.
Post Reply