* Version $Id$
*/
/*
- Copyright (C) 2000-2003 Kern Sibbald and John Walker
+ Copyright (C) 2000-2004 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
return dt;
}
+/* Formatted time for user display: dd-Mon-yy hh:mm (no century) */
+char *bstrftime_nc(char *dt, int maxlen, utime_t tim)
+{
+ time_t ttime = tim;
+ struct tm tm;
+
+ /* ***FIXME**** the format and localtime_r() should be user configurable */
+ localtime_r(&ttime, &tm);
+ /* NOTE! since the compiler complains about %y, I use %y and cut the century */
+ strftime(dt, maxlen, "%d-%b-%Y %H:%M", &tm);
+ strcpy(dt+7, dt+9);
+ return dt;
+}
+
+
/* Unix time to standard time string yyyy-mm-dd hh:mm:ss */
char *bstrutime(char *dt, int maxlen, utime_t tim)
{
}
/*
- * Return the week of the month, base 0 (wpos)
+ * Return the week of the month, base 0 (wom)
* given tm_mday and tm_wday. Value returned
* can be from 0 to 4 => week1, ... week5
*/
fs += 7;
}
if (mday <= fs) {
-// Dmsg2(100, "wom=0 wday=%d <= fs=%d\n", wday, fs);
+// Dmsg3(100, "mday=%d wom=0 wday=%d <= fs=%d\n", mday, wday, fs);
return 0;
}
int wom = 1 + (mday - fs - 1) / 7;
-// Dmsg3(100, "wom=%d wday=%d fs=%d\n", wom, wday, fs);
+// Dmsg4(100, "mday=%d wom=%d wday=%d fs=%d\n", mday, wom, wday, fs);
return wom;
}