---End cut here--- @cond Doxygen_Suppress
| 2858 | //---End cut here--- |
| 2859 | //! @cond Doxygen_Suppress |
| 2860 | char *date_strget(char *buf, int buflen, int localtime) |
| 2861 | { |
| 2862 | char tmpbuf[64]; |
| 2863 | struct tm *mytm; |
| 2864 | time_t t; |
| 2865 | struct timeval tv; |
| 2866 | struct tm result = { 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 2867 | int mytimezone; |
| 2868 | |
| 2869 | // 2038 failure here for 32-bit time_t |
| 2870 | t = time(NULL); |
| 2871 | |
| 2872 | if (localtime) |
| 2873 | { |
| 2874 | mytm = localtime_r(&t, &result); |
| 2875 | #if defined(_WIN32) |
| 2876 | mytimezone = timezone; |
| 2877 | #else |
| 2878 | mytimezone = - (int)result.tm_gmtoff; // does not compile on mingw |
| 2879 | #endif |
| 2880 | } |
| 2881 | else |
| 2882 | { |
| 2883 | mytm = gmtime_r(&t, &result); |
| 2884 | mytimezone = 0; |
| 2885 | } |
| 2886 | |
| 2887 | strftime(buf, buflen, "%Y-%m-%dT%H:%M:%S.", mytm); |
| 2888 | gettimeofday(&tv, NULL); |
| 2889 | SNPRINTF(tmpbuf, sizeof(tmpbuf), "%06ld", (long)tv.tv_usec); |
| 2890 | strcat(buf, tmpbuf); |
| 2891 | SNPRINTF(tmpbuf, sizeof(tmpbuf), "%s%04d", mytimezone >= 0 ? "-" : "+", |
| 2892 | ((int)abs(mytimezone) / 3600) * 100); |
| 2893 | strcat(buf, tmpbuf); |
| 2894 | return buf; |
| 2895 | } |
| 2896 | |
| 2897 | char *rig_date_strget(char *buf, int buflen, int localtime) |
| 2898 | { |
no test coverage detected