Class library for the Dallas Semiconductor DS1307 RTC Basic Functionality, read and set RTC

Revision:
1:95a90bac5d6d
Parent:
0:2bbb23558624
Child:
2:a9a0784930bd
--- a/DS1307_RTC.cpp	Sat Oct 11 06:04:41 2014 +0000
+++ b/DS1307_RTC.cpp	Sat Nov 01 14:05:25 2014 +0000
@@ -14,6 +14,26 @@
   
     Day[0] = "";
     Day[1] = "Sun";
+    Day[2] = "Mon";
+    Day[3] = "Tue";
+    Day[4] = "Wed";
+    Day[5] = "Thu";
+    Day[6] = "Fri";
+    Day[7] = "Sat";
+    
+    Mon[0] = "";
+    Mon[1] = "Jan";
+    Mon[2] = "Feb";
+    Mon[3] = "Mar";
+    Mon[4] = "Apr";
+    Mon[5] = "May";
+    Mon[6] = "Jun";
+    Mon[7] = "Jul";
+    Mon[8] = "Aug";
+    Mon[9] = "Sep";
+    Mon[10] = "Oct";
+    Mon[11] = "Nov";
+    Mon[12] = "Dec";
        
     rtc_sec = 0;
     rtc_minute = 0;
@@ -94,6 +114,24 @@
     RTC_write_reg(0, bcd(rtc_sec));     //seconds reg
 }
 
+void DS1307_RTC::set_RTC_time_UTC(float utc_time, int timezone){
+    int Hour = (int)((int)utc_time/10000) + timezone;
+    if(Hour < 0)
+        Hour += 24;
+    
+    int Min = (int)((int)utc_time/100%100);
+    int Sec = (int)utc_time % 100;
+            
+/*    RTC_write_reg(6, bcd(rtc_year));    //seconds reg
+    RTC_write_reg(5, bcd(rtc_month));   //month reg
+    RTC_write_reg(3, bcd(rtc_day));   //day reg
+    RTC_write_reg(4, bcd(rtc_date));   //date reg*/
+    
+    RTC_write_reg(2, bcd(Hour));   //hour reg    
+    RTC_write_reg(1, bcd(Min));   //minute reg
+    RTC_write_reg(0, bcd(Sec));     //seconds reg    
+}
+
 void DS1307_RTC::get_RTC_time(char *str)
 {   
     rtc_sec = unbcd(RTC_read_reg(0));    //