1 This patch should resolve some problems with handling of am/pm
2 in schedules as reported by bug #808.
4 According to the NIST (US National Institute of Standards and Technology),
5 12am and 12pm are ambiguous and can be defined to anything. However,
6 12:01am is the same as 00:01 and 12:01pm is the same as 12:01, so Bacula
7 defines 12am as 00:00 (midnight) and 12pm as 12:00 (noon). You can avoid
8 this abiguity (confusion) by using 24 hour time specifications (i.e. no
9 am/pm). This is the definition in Bacula version 2.0.3 and later.
11 Apply it to version 2.0.3 with:
14 patch -p0 <2.0.3-ampm.patch
19 Index: src/dird/run_conf.c
20 ===================================================================
21 --- src/dird/run_conf.c (revision 4349)
22 +++ src/dird/run_conf.c (working copy)
24 for ( ; token != T_EOL; (token = lex_get_token(lc, T_ALL))) {
33 clear_bits(0, 23, lrun.hour);
35 +// Dmsg1(000, "s_time=%s\n", lc->str);
36 p = strchr(lc->str, ':');
38 scan_err0(lc, _("Time logic error.\n"));
41 *p++ = 0; /* separate two halves */
42 code = atoi(lc->str); /* pick up hour */
43 + code2 = atoi(p); /* pick up minutes */
45 - if (len > 2 && p[len-1] == 'm') {
46 - if (p[len-2] == 'a') {
48 - } else if (p[len-2] == 'p') {
51 - scan_err0(lc, _("Bad time specification."));
59 - code2 = atoi(p); /* pick up minutes */
60 + if (strcasecmp(p, "pm") == 0) {
62 + } else if (strcasecmp(p, "am") == 0) {
64 + } else if (len != 2) {
65 + scan_err0(lc, _("Bad time specification."));
69 * Note, according to NIST, 12am and 12pm are ambiguous and
70 * can be defined to anything. However, 12:01am is the same
75 - } else if (code == 12) {
76 + } else if (am && code == 12) {
79 if (code < 0 || code > 23 || code2 < 0 || code2 > 59) {
80 scan_err0(lc, _("Bad time specification."));
83 +// Dmsg2(000, "hour=%d min=%d\n", code, code2);
84 set_bit(code, lrun.hour);