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

Log Message:
-----------
Send local time values to the iPod

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

Modified: libgpod/trunk/tools/ipod-scsi.c
===================================================================
--- libgpod/trunk/tools/ipod-scsi.c     2009-03-26 22:11:40 UTC (rev 2287)
+++ libgpod/trunk/tools/ipod-scsi.c     2009-03-26 22:11:51 UTC (rev 2288)
@@ -35,6 +35,7 @@
 #include <unistd.h>
 #include <scsi/sg_cmds.h>
 #include <sys/stat.h>
+#include <time.h>
 
 #include <glib.h>
 
@@ -120,6 +121,17 @@
     close(fd);
 }
 
+static long get_local_timezone (void)
+{
+    tzset();
+#ifdef __CYGWIN__
+    return (gint) _timezone; /* global variable defined by time.h, see man 
tzset */
+#else
+    return timezone; /* global variable defined by time.h, see man tzset */
+#endif
+}
+
+
 G_GNUC_INTERNAL void sync_time (const char *device, time_t current_time, gint 
timezone)
 {
     struct iPodTime {
@@ -134,6 +146,9 @@
     struct iPodTime ipod_time;
     GDate *date;
 
+    /* the ipod expects a local time, not UTC */
+    current_time -= get_local_timezone ();
+
     date = g_date_new ();
     g_date_set_time_t (date, current_time);
     ipod_time.year = GUINT16_TO_BE (g_date_get_year (date));


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