Ticket #5319: mythtv-5319-add_query_timezone_to_protocol.patch
File mythtv-5319-add_query_timezone_to_protocol.patch, 2.3 KB (added by , 16 years ago) |
---|
-
programs/mythbackend/mainserver.h
135 135 void HandleQueryLoad(PlaybackSock *pbs); 136 136 void HandleQueryUptime(PlaybackSock *pbs); 137 137 void HandleQueryMemStats(PlaybackSock *pbs); 138 void HandleQueryTimezone(PlaybackSock *pbs); 138 139 void HandleBlockShutdown(bool blockShutdown, PlaybackSock *pbs); 139 140 140 141 void SendResponse(MythSocket *pbs, QStringList &commands); -
programs/mythbackend/mainserver.cpp
15 15 #include <math.h> 16 16 #include <unistd.h> 17 17 #include <fcntl.h> 18 #include <time.h> 18 19 #include "../../config.h" 19 20 #ifdef HAVE_SYS_SOUNDCARD_H 20 21 #include <sys/soundcard.h> … … 374 375 { 375 376 HandleQueryMemStats(pbs); 376 377 } 378 else if (command == "QUERY_TIMEZONE") 379 { 380 HandleQueryTimezone(pbs); 381 } 377 382 else if (command == "QUERY_CHECKFILE") 378 383 { 379 384 HandleQueryCheckFile(listline, pbs); … … 2310 2315 2311 2316 /** 2312 2317 * \addtogroup myth_network_protocol 2318 * \par QUERY_TIMEZONE 2319 * Returns timezone offset, timezone name 2320 */ 2321 void MainServer::HandleQueryTimezone(PlaybackSock *pbs) 2322 { 2323 MythSocket *pbssock = pbs->getSocket(); 2324 QStringList strlist; 2325 QString offset("UNDEF"); 2326 QString name("UNDEF"); 2327 2328 #ifndef USING_MINGW 2329 char zone_string[64]; 2330 time_t t; 2331 struct tm *result = (struct tm *)malloc(sizeof(*result)); 2332 2333 t = time(NULL); 2334 localtime_r(&t, result); 2335 2336 if (result != NULL) 2337 { 2338 if (strftime(zone_string, sizeof(zone_string), "%z", result) > 0) 2339 offset = zone_string; 2340 if (strftime(zone_string, sizeof(zone_string), "%Z", result) > 0) 2341 name = zone_string; 2342 } 2343 2344 if (result != NULL) 2345 free(result); 2346 2347 #endif 2348 strlist << offset << name; 2349 2350 SendResponse(pbssock, strlist); 2351 } 2352 2353 /** 2354 * \addtogroup myth_network_protocol 2313 2355 * \par QUERY_CHECKFILE \e checkslaves \e programinfo 2314 2356 */ 2315 2357 void MainServer::HandleQueryCheckFile(QStringList &slist, PlaybackSock *pbs)