diff --git a/src/xpdev/xpdatetime.c b/src/xpdev/xpdatetime.c index 2ebb074c1c1d127899263ac0a9e86d6b3243d597..ed50017bfd295bc009a01d744fadcb9fa1558042 100644 --- a/src/xpdev/xpdatetime.c +++ b/src/xpdev/xpdatetime.c @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2010 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright Rob Swindell - http://www.synchro.net/copyright.html * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -123,6 +123,7 @@ xpTimeZone_t DLLCALL xpTimeZone_local(void) #endif } +/* TODO: Supports local timezone and UTC only, currently */ time_t DLLCALL xpDateTime_to_time(xpDateTime_t xpDateTime) { struct tm tm; @@ -140,7 +141,11 @@ time_t DLLCALL xpDateTime_to_time(xpDateTime_t xpDateTime) tm.tm_min = xpDateTime.time.minute; tm.tm_sec = (int)xpDateTime.time.second; - return sane_mktime(&tm); + if(xpDateTime.zone == xpTimeZone_UTC) + return sane_timegm(&tm); + if(xpDateTime.zone == xpTimeZone_LOCAL || xpDateTime.zone == xpTimeZone_local()) + return sane_mktime(&tm); + return INVALID_TIME; } xpDateTime_t DLLCALL time_to_xpDateTime(time_t ti, xpTimeZone_t zone)