spoolss: pretty-print a struct spoolss_Time.
[samba.git] / librpc / ndr / ndr_spoolss_buf.c
index 5aa89e408eb96c903aab939b51bf97789783f2b4..811a8e2accbca3d854368929922a1ed2613bb88d 100644 (file)
@@ -1382,3 +1382,30 @@ _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterInfo2(struct ndr_push *ndr, i
        }
        return NDR_ERR_SUCCESS;
 }
+
+_PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r)
+{
+       struct tm tm;
+       time_t t;
+       char *str;
+
+       tm.tm_sec       = r->second;
+       tm.tm_min       = r->minute;
+       tm.tm_hour      = r->hour;
+       tm.tm_mday      = r->day;
+       tm.tm_mon       = r->month - 1;
+       tm.tm_year      = r->year - 1900;
+       tm.tm_wday      = r->day_of_week;
+       tm.tm_yday      = 0;
+       tm.tm_isdst     = -1;
+
+       t = mktime(&tm);
+
+       str = timestring(ndr, t);
+
+       ndr_print_struct(ndr, name, "spoolss_Time");
+       ndr->depth++;
+       ndr_print_string(ndr, "", str);
+       ndr->depth--;
+       talloc_free(str);
+}