David Smart / iCal
Revision:
1:db274b9e40cc
Parent:
0:49245357cd1b
Child:
2:1f5dbc624b95
--- a/iCal.cpp	Sun Apr 20 13:25:50 2014 +0000
+++ b/iCal.cpp	Sun Apr 20 16:34:18 2014 +0000
@@ -66,7 +66,7 @@
     return res;
 }
 
-time_t ParseDateStamp(char * string, NTPClient & ntp)
+time_t ParseDateStamp(char * string, int32_t tzoSec)
 {
     time_t tStamp;
     struct tm t;
@@ -79,7 +79,7 @@
     t.tm_sec  = AtoIxN(string+13, 2);
     tStamp = mktime(&t);
     if (string[strlen(string)-1] == 'Z')
-        tStamp = tStamp + ntp.getTZO();
+        tStamp = tStamp + tzoSec;
     return tStamp;
     //int tm_sec //seconds after the minute – [0, 60][@1]    (public member object)
     //int tm_min  //minutes after the hour – [0, 59]    (public member object)
@@ -228,7 +228,7 @@
 
 
 
-void ParseICalStream(char * pStart, time_t gridStartTime, time_t gridEndTime, NTPClient & ntp)
+void ParseICalStream(char * pStart, time_t gridStartTime, time_t gridEndTime, int32_t tzoSec)
 {
     Event_T Event;
     bool tzAdjusted = false;
@@ -280,8 +280,8 @@
                     if (strcmp(pStart, "END:VEVENT") == 0) {
                         // Timezone offset
                         if (!tzAdjusted) {
-                            Event.Start += ntp.getTZO();
-                            Event.End   += ntp.getTZO();
+                            Event.Start += tzoSec;
+                            Event.End   += tzoSec;
                         }
                         // Process it
                         ShowEventInfo(Event);
@@ -292,21 +292,21 @@
                         }
                         seeking = idle;
                     } else if (strncmp(pStart, "DTSTART:", 8) == 0) {
-                        Event.Start = ParseDateStamp(pStart+8, ntp);
+                        Event.Start = ParseDateStamp(pStart+8, tzoSec);
                         //INFO("  Start: %d\r\n", mktime(&Event.eventStart));
                     } else if (strncmp(pStart, "DTSTART;", 8) == 0) {
                         char * p = strrchr(pStart, ':');
                         if (p) {
-                            Event.Start = ParseDateStamp(p+1, ntp);
+                            Event.Start = ParseDateStamp(p+1, tzoSec);
                             //INFO("  Start: %d\r\n", mktime(&Event.eventStart));
                         }
                     } else if (strncmp(pStart, "DTEND:", 6) == 0) {
-                        Event.End = ParseDateStamp(pStart+6, ntp);
+                        Event.End = ParseDateStamp(pStart+6, tzoSec);
                         //INFO("    End: %d\r\n", mktime(&Event.eventEnd));
                     } else if (strncmp(pStart, "DTEND;", 6) == 0) {
                         char * p = strrchr(pStart, ':');
                         if (p) {
-                            Event.End = ParseDateStamp(p+1, ntp);
+                            Event.End = ParseDateStamp(p+1, tzoSec);
                             //INFO("    End: %d\r\n", mktime(&Event.eventEnd));
                         }
                     } else if (strncmp(pStart, "SUMMARY:", 8) == 0) {
@@ -365,7 +365,7 @@
                             } else if (strncmp(p1, "UNTIL=", 6) == 0) {
                                 INFO("%s", p1);
                                 p1 += 6;                // p1 = 20140502T180000;BYDAY=MO,TU,WE,TH,FR
-                                Event.Until = ParseDateStamp(p1, ntp);
+                                Event.Until = ParseDateStamp(p1, tzoSec);
                             } else if (strncmp(p1, "BYDAY=", 6) == 0) {
                                 INFO("%s", p1);
                                 p1 += 6;        // p1 = MO,TU,WE,TH,FR