]> pilppa.org Git - lib1wire.git/blobdiff - src/Date.cc
Year fix when for Date function.
[lib1wire.git] / src / Date.cc
index 8327d1513924a17afd33fd1a038d57b2aefbc73a..b8b57140d2a4ea3dbd9d2f4c086d55d6a47b449c 100644 (file)
@@ -11,6 +11,8 @@
 #include <time.h>
 #include <malloc.h>
 
+#include <plp/log.h>
+
 #include "Date.hh"
 
 using namespace std;
@@ -24,7 +26,7 @@ Date::Date() {
 
        time(&wtime);
        ltime   = localtime(&wtime);
-       year    = ltime->tm_year;
+       year    = 1900 + ltime->tm_year;
        month   = ltime->tm_mon;
        day     = ltime->tm_mday;
        hour    = ltime->tm_hour;
@@ -62,7 +64,7 @@ bool Date::is_leap_year() {
 }
 
 void Date::printout() {
-       cout << "date: " << year << " " << month << " " << day << " " << hour << " " << min << " " << sec << endl;
+       log_debug("%d-%02d-%02d %02d:%02d:%02d\n", year, month, day, hour, min, sec);
 }
 
 Date *Date::clone() {