Revision: 2287
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2287&view=rev
Author:   teuf
Date:     2009-03-26 22:11:40 +0000 (Thu, 26 Mar 2009)

Log Message:
-----------
Pass timezone value as an argument

Modified Paths:
--------------
    libgpod/trunk/tools/ipod-scsi.c
    libgpod/trunk/tools/ipod-time-sync.c

Modified: libgpod/trunk/tools/ipod-scsi.c
===================================================================
--- libgpod/trunk/tools/ipod-scsi.c     2009-03-26 22:11:27 UTC (rev 2286)
+++ libgpod/trunk/tools/ipod-scsi.c     2009-03-26 22:11:40 UTC (rev 2287)
@@ -38,7 +38,7 @@
 
 #include <glib.h>
 
-extern void sync_time (const char *device, time_t current_time);
+extern void sync_time (const char *device, time_t current_time, gint timezone);
 extern char *read_sysinfo_extended (const char *device);
 /* do_sg_inquiry and read_sysinfo_extended were heavily
  * inspired from libipoddevice
@@ -120,7 +120,7 @@
     close(fd);
 }
 
-G_GNUC_INTERNAL void sync_time (const char *device, time_t current_time)
+G_GNUC_INTERNAL void sync_time (const char *device, time_t current_time, gint 
timezone)
 {
     struct iPodTime {
        guint16 year;
@@ -138,7 +138,7 @@
     g_date_set_time_t (date, current_time);
     ipod_time.year = GUINT16_TO_BE (g_date_get_year (date));
     ipod_time.days = GUINT16_TO_BE (g_date_get_day_of_year (date)-1);
-    ipod_time.timezone = 4; /* FIXME: figure out all the values */
+    ipod_time.timezone = timezone;
     ipod_time.hour = current_time/3600 % 24;
     ipod_time.minute = current_time/60 % 60;
     ipod_time.second = current_time % 60;

Modified: libgpod/trunk/tools/ipod-time-sync.c
===================================================================
--- libgpod/trunk/tools/ipod-time-sync.c        2009-03-26 22:11:27 UTC (rev 
2286)
+++ libgpod/trunk/tools/ipod-time-sync.c        2009-03-26 22:11:40 UTC (rev 
2287)
@@ -23,20 +23,26 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
+
 #include <glib.h>
 #include <glib/gi18n.h>
 
-extern void sync_time (const char *device, time_t current_time);
+extern void sync_time (const char *device, time_t current_time, gint timezone);
 
 int
 main (int argc, char **argv)
 {
     if (argc < 2) {
-        g_print (_("usage: %s <device>\n"), g_basename (argv[0]));
+        g_print (_("usage: %s <device> [timezone]\n"), g_basename (argv[0]));
        return 1;
     }
 
-    sync_time (argv[1], time (NULL));
+    if (argc < 3) {
+        sync_time (argv[1], time (NULL), 0);
+    } else {
+        sync_time (argv[1], time (NULL), atoi (argv[2]));
+    }
 
     return 0;
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to