blob: 9273c5d4a7da9484dc04e9391798c39a0710c6ad [file] [log] [blame] [raw]
/* A part of the Windows CE C Extra Library (celibc)
Copyright 2007-2015 PC GO Ld.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*/
#include <sys/time.h>
#include <windows.h>
#include <shared.h>
#if _WCE >= 3
void GetCurrentFT(FILETIME *);
#endif
int gettimeofday(struct timeval *tv, struct timezone *tz) {
// Ignore the tz argument
if(!tv) return 0;
//time_t t = time(NULL);
//if(t == -1) return -1;
FILETIME ft;
#if _WCE >= 3
GetCurrentFT(&ft);
#else
SYSTEMTIME st;
GetSystemTime(&st);
if(!SystemTimeToFileTime(&st, &ft)) return -1;
#endif
__filetime_to_timeval(&ft, tv);
return 0;
}