Warning, file /sdk/codevis/thirdparty/soci/include/private/soci-mktime.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // Copyright (C) 2015 Vadim Zeitlin.
0003 // Distributed under the Boost Software License, Version 1.0.
0004 // (See accompanying file LICENSE_1_0.txt or copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef SOCI_PRIVATE_SOCI_MKTIME_H_INCLUDED
0009 #define SOCI_PRIVATE_SOCI_MKTIME_H_INCLUDED
0010 
0011 // Not <ctime> because we also want to get timegm() if available.
0012 #include <time.h>
0013 
0014 #ifdef _WIN32
0015 #define timegm _mkgmtime
0016 #endif
0017 
0018 namespace soci
0019 {
0020 
0021 namespace details
0022 {
0023 
0024 // Fill the provided struct tm with the values corresponding to the given date
0025 // in UTC.
0026 //
0027 // Notice that both years and months are normal human 1-based values here and
0028 // not 1900 or 0-based as in struct tm itself.
0029 inline
0030 void
0031 mktime_from_ymdhms(tm& t,
0032                    int year, int month, int day,
0033                    int hour, int minute, int second)
0034 {
0035     t.tm_isdst = -1;
0036     t.tm_year = year - 1900;
0037     t.tm_mon  = month - 1;
0038     t.tm_mday = day;
0039     t.tm_hour = hour;
0040     t.tm_min  = minute;
0041     t.tm_sec  = second;
0042 
0043     timegm(&t);
0044 }
0045 
0046 // Helper function for parsing datetime values.
0047 //
0048 // Throws if the string in buf couldn't be parsed as a date or a time string.
0049 SOCI_DECL void parse_std_tm(char const *buf, std::tm &t);
0050 
0051 } // namespace details
0052 
0053 } // namespace soci
0054 
0055 #endif // SOCI_PRIVATE_SOCI_MKTIME_H_INCLUDED