don't use -u switch to /bin/date - too many systems don't honor it
authorAndrew Tridgell <tridge@samba.org>
Fri, 14 Dec 2001 01:15:14 +0000 (01:15 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 14 Dec 2001 01:15:14 +0000 (01:15 +0000)
(This used to be commit 0839cf03a92673b38f1afa103271c708fa7162a2)

source3/utils/net_time.c

index 20d51e2a41205f9593bb6a741fef7d781521b8b6..dea1bcd6776dded515ee1c553b08a074f58794bd 100644 (file)
@@ -73,13 +73,13 @@ static time_t nettime(int *zone)
        return cli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, zone);
 }
 
-/* return a time as a string ready to be passed to date -u */
+/* return a time as a string ready to be passed to /bin/date */
 static char *systime(time_t t)
 {
        static char s[100];
        struct tm *tm;
 
-       tm = gmtime(&t);
+       tm = localtime(&t);
        
        snprintf(s, sizeof(s), "%02d%02d%02d%02d%04d.%02d", 
                 tm->tm_mon+1, tm->tm_mday, tm->tm_hour, 
@@ -92,7 +92,7 @@ int net_time_usage(int argc, const char **argv)
        d_printf(
 "net time\n\tdisplays time on a server\n\n"\
 "net time system\n\tdisplays time on a server in a format ready for /bin/date\n\n"\
-"net time set\n\truns /bin/date -u with the time from the server\n\n"\
+"net time set\n\truns /bin/date with the time from the server\n\n"\
 "net time zone\n\tdisplays the timezone in hours from GMT on the remote computer\n\n"\
 "\n");
        general_rap_usage(argc, argv);
@@ -110,7 +110,7 @@ static int net_time_set(int argc, const char **argv)
        /* yes, I know this is cheesy. Use "net time system" if you want to 
           roll your own. I'm putting this in as it works on a large number
           of systems and the user has a choice in whether its used or not */
-       asprintf(&cmd, "/bin/date -u %s", systime(t));
+       asprintf(&cmd, "/bin/date %s", systime(t));
        system(cmd);
        free(cmd);