Teach srfsh to pull TZ from the environment and pass it with requests user/miker/client-tz
authorMike Rylander <mrylander@gmail.com>
Mon, 3 Aug 2015 17:27:56 +0000 (13:27 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 4 Aug 2015 16:13:41 +0000 (12:13 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
src/srfsh/srfsh.c

index d8132d1..e3705a9 100644 (file)
@@ -37,6 +37,7 @@ static void get_misc( ArgParser* parser );
 #define SRFSH_PORT 5222
 #define COMMAND_BUFSIZE 4096
 
+static char* tz = NULL;
 
 /* shell prompt */
 static const char* prompt = "srfsh# ";
@@ -104,6 +105,7 @@ int main( int argc, char* argv[] ) {
        /* --------------------------------------------- */
        /* see if they have a .srfsh.xml in their home directory */
        char* home = getenv("HOME");
+       tz = getenv("TZ");
        int l = strlen(home) + 36;
        char fbuf[l];
        snprintf(fbuf, sizeof(fbuf), "%s/.srfsh.xml", home);
@@ -798,6 +800,8 @@ int send_request( const char* server,
                session_is_temporary = 1;                     // just for this request
        }
 
+       if (tz) osrf_app_session_set_tz(session,tz);
+
        double start = get_timestamp_millis();
 
        int req_id = osrfAppSessionSendRequest( session, params, method, 1 );