| 113 | } |
| 114 | |
| 115 | static void getTimezoneOffset() |
| 116 | { |
| 117 | #ifdef __USE_MISC |
| 118 | if (*M_G_gmt_offset) { |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | struct tm L_currentDate; |
| 123 | // Get the current date and time |
| 124 | time_t now = time(NULL); |
| 125 | // Convert to local time |
| 126 | localtime_r(&now, &L_currentDate); |
| 127 | |
| 128 | long gmtoff = L_currentDate.tm_gmtoff; |
| 129 | if (gmtoff == 0) { |
| 130 | strcpy(M_G_gmt_offset, "Z"); |
| 131 | } else { |
| 132 | int hh = gmtoff / 3600; |
| 133 | int mm = abs(gmtoff / 60) % 60; |
| 134 | snprintf(M_G_gmt_offset, sizeof(M_G_gmt_offset), "%+.2d:%.2d", hh, mm); |
| 135 | } |
| 136 | #endif |
| 137 | } |
| 138 | |
| 139 | /* |
| 140 | __________________________________________________________________________ |