/* (C) 2003-2007 Willem Jan Hengeveld * Web: http://www.xs4all.nl/~itsme/ * http://wiki.xda-developers.com/ * * $Id: psynctime.cpp 1921 2008-07-31 17:08:31Z itsme $ * * to start this util automatically each time a device is cradled: * * [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services\AutoStartOnConnect] * "psynctime"="c:\\path-to\\psynctime.exe" * */ #include #include #include #include #include #include "debug.h" #include "ItsUtils.h" #include "dllversion.h" bool ITSetSystemTime(bool bSetLocal, bool bSetSystem, bool bSetTz, SYSTEMTIME *time, TIME_ZONE_INFORMATION *tzinfo); bool ITGetSystemTime(bool bGetLocal, SYSTEMTIME *time, TIME_ZONE_INFORMATION *tzinfo, DWORD *ptzid); void usage() { printf("(C) 2003-2008 Willem jan Hengeveld itsme@xs4all.nl\n"); printf("Usage: psynctime [-l | -s] [-t] [-v]\n"); printf(" -l : set local time\n"); printf(" -s : set system time\n"); printf(" -t : set timezone\n"); printf(" -v : verbose\n"); printf(" -q : query only\n"); } int main( int argc, char *argv[]) { DebugStdOut(); bool bSetLocal= false; bool bSetSystem= true; // bool bUseRapicall= false; bool bSetTz= true; bool bVerbose= false; for (int i=1 ; itime), sizeof(SYSTEMTIME)); memcpy(tzinfo, &(outbuf->tzinfo), sizeof(TIME_ZONE_INFORMATION)); *ptzid= outbuf->tzid; LocalFree(outbuf); } return res==0; }