]> pilppa.org Git - libplp.git/blobdiff - src/Date.cc
Data read optimizations
[libplp.git] / src / Date.cc
index 461c9d0022a3274d4ba0e72045362d3a88bf377d..e8314771a0858286ae945f8342f26bab8084b5b4 100644 (file)
@@ -243,6 +243,24 @@ void Date::next_hour() {
        }
 }
 
+bool Date::is_last_day_of_month() {
+       bool ret_val;
+       int days_in_month;
+
+       days_in_month = -1;
+       if ((month > 0) &&
+           (month <= 12)) {
+               days_in_month = CONST__DAYS_PER_MONTH[month - 1];
+               if ((month == 2) &&
+                   (is_leap_year() == true)) {
+                       days_in_month = 29;
+               }
+       }
+       ret_val = (day == days_in_month);
+       //log_debug("ret_val: %d", ret_val);
+       return ret_val;
+}
+
 void Date::next_day() {
        if ((month > 0) &&
            (month <= 12)) {
@@ -365,8 +383,8 @@ string Date::to_sortable_string() {
 }
 
 string Date::to_string() {
-       char    buffer[30];
        string  ret_val;
+       char    buffer[40];
 
        sprintf(buffer, "%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, min, sec);
        ret_val = buffer;