diff --git a/aqvm/base/file/identifier/windows/identifier.c b/aqvm/base/file/identifier/windows/identifier.c index 0ce9a04..82ab569 100644 --- a/aqvm/base/file/identifier/windows/identifier.c +++ b/aqvm/base/file/identifier/windows/identifier.c @@ -5,7 +5,7 @@ #include "aqvm/base/file/identifier/windows/identifier.h" -#include +#include #include "aqvm/base/hash/hash.h" diff --git a/aqvm/base/file/identifier/windows/identifier.h b/aqvm/base/file/identifier/windows/identifier.h index 2b5d09c..33c1882 100644 --- a/aqvm/base/file/identifier/windows/identifier.h +++ b/aqvm/base/file/identifier/windows/identifier.h @@ -7,7 +7,7 @@ #define AQ_AQVM_BASE_FILE_IDENTIFIER_WINDOWS_IDENTIFIER_H_ #include -#include +#include #include "aqvm/base/file/file.h" diff --git a/aqvm/base/file/windows/file.c b/aqvm/base/file/windows/file.c index 887cd71..4c389c8 100644 --- a/aqvm/base/file/windows/file.c +++ b/aqvm/base/file/windows/file.c @@ -3,7 +3,7 @@ #include #include -#include +#include #include "aqvm/base/file/file.h" diff --git a/aqvm/base/file/windows/file.h b/aqvm/base/file/windows/file.h index d9eeb30..f407114 100644 --- a/aqvm/base/file/windows/file.h +++ b/aqvm/base/file/windows/file.h @@ -7,7 +7,7 @@ #define AQ_AQVM_BASE_FILE_WINDOWS_FILE_H_ #include -#include +#include #include "aqvm/base/file/file.h" diff --git a/aqvm/base/process/file_lock/windows/file_lock.c b/aqvm/base/process/file_lock/windows/file_lock.c index d4b2783..d0c07a1 100644 --- a/aqvm/base/process/file_lock/windows/file_lock.c +++ b/aqvm/base/process/file_lock/windows/file_lock.c @@ -6,7 +6,7 @@ #include "aqvm/base/process/file_lock/windows/file_lock.h" #include -#include +#include #include "aqvm/base/file/windows/file.h" diff --git a/aqvm/base/threading/mutex/windows/mutex.c b/aqvm/base/threading/mutex/windows/mutex.c index f10471a..4d08420 100644 --- a/aqvm/base/threading/mutex/windows/mutex.c +++ b/aqvm/base/threading/mutex/windows/mutex.c @@ -6,7 +6,7 @@ #include "aqvm/base/threading/mutex/windows/mutex.h" #include -#include +#include int AqvmBaseThreadingMutexWindows_InitializeMutex( AqvmBaseThreadingMutexWindows_Mutex *mutex) { diff --git a/aqvm/base/threading/mutex/windows/mutex.h b/aqvm/base/threading/mutex/windows/mutex.h index db846bb..b28c46a 100644 --- a/aqvm/base/threading/mutex/windows/mutex.h +++ b/aqvm/base/threading/mutex/windows/mutex.h @@ -6,7 +6,7 @@ #ifndef AQ_AQVM_BASE_THREADING_MUTEX_WINDOWS_MUTEX_H_ #define AQ_AQVM_BASE_THREADING_MUTEX_WINDOWS_MUTEX_H_ -#include +#include typedef HANDLE AqvmBaseThreadingMutexWindows_Mutex; diff --git a/aqvm/base/time/time.c b/aqvm/base/time/time.c index e63c26e..1b81f2f 100644 --- a/aqvm/base/time/time.c +++ b/aqvm/base/time/time.c @@ -62,28 +62,38 @@ int AqvmBaseTime_GetCurrentTime(struct AqvmBaseTime_Time* result) { return -3; } #else - struct tm local_time; - if (AqvmBaseTime_localtime(time(NULL), &local_time) != 0) { + struct tm time; + if (AqvmBaseTime_localtime(time(NULL), &time) != 0) { // TODO return -4; } - result->year = local_time.tm_year + 1900; - result->month = local_time.tm_mon + 1; - result->day = local_time.tm_mday; - result->hour = local_time.tm_hour; - result->minute = local_time.tm_min; - result->second = local_time.tm_sec; - result->millisecond = 0; - result->weekday = local_time.tm_wday; - result->yearday = local_time.tm_yday; - result->isdst = local_time.tm_isdst; + if (AqvmBaseTime_ConvertTmToTime(&time, result) != 0) { + // TODO + return -5; + } #endif return 0; } -int AqvmBaseTime_ConvertTmToTime(){ +int AqvmBaseTime_ConvertTmToTime(const struct tm* time, + struct AqvmBaseTime_Time* result) { + if (time == NULL || result == NULL) { + // TODO + return -1; + } + result->year = time->tm_year + 1900; + result->month = time->tm_mon + 1; + result->day = time->tm_mday; + result->hour = time->tm_hour; + result->minute = time->tm_min; + result->second = time->tm_sec; + result->millisecond = 0; + result->weekday = time->tm_wday; + result->yearday = time->tm_yday; + result->isdst = time->tm_isdst; + return 0; } int AqvmBaseTime_GetCurrentTimeString(char* result) { diff --git a/aqvm/base/time/time.h b/aqvm/base/time/time.h index a269b7c..a8a9667 100644 --- a/aqvm/base/time/time.h +++ b/aqvm/base/time/time.h @@ -24,7 +24,8 @@ int AqvmBaseTime_localtime(const time_t timestamp, struct tm* result); int AqvmBaseTime_GetCurrentTime(struct AqvmBaseTime_Time* result); -int AqvmBaseTime_ConvertTmToTime(char* result); +int AqvmBaseTime_ConvertTmToTime(const struct tm* time, + struct AqvmBaseTime_Time* result); // Get the current time. The current time is then formatted as an ISO 8601 // compliant string and written to |result|. |result| must not be NULL and must diff --git a/aqvm/base/time/windows/time.c b/aqvm/base/time/windows/time.c index f1c2a62..21e0fcf 100644 --- a/aqvm/base/time/windows/time.c +++ b/aqvm/base/time/windows/time.c @@ -5,6 +5,7 @@ #include "aqvm/base/time/windows/time.h" +#include #include #include "aqvm/base/logging/logging.h" @@ -18,7 +19,13 @@ int AqvmBaseTimeWindows_localtime(const time_t timestamp, struct tm* result) { return 0; } -int AqvmBaseTimeWindows_GetCurrentTime(struct AqvmBaseTime_Time* result){ +int AqvmBaseTimeWindows_GetCurrentTime(struct AqvmBaseTime_Time* result) { + if (result == NULL) { + // TODO + return -1; + } + + return 0; } #endif \ No newline at end of file