diff options
Diffstat (limited to 'usr.bin/mandoc/man_action.c')
-rw-r--r-- | usr.bin/mandoc/man_action.c | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/usr.bin/mandoc/man_action.c b/usr.bin/mandoc/man_action.c index e45de11fcb2..4732d148d81 100644 --- a/usr.bin/mandoc/man_action.c +++ b/usr.bin/mandoc/man_action.c @@ -1,4 +1,4 @@ -/* $Id: man_action.c,v 1.10 2009/12/22 23:58:00 schwarze Exp $ */ +/* $Id: man_action.c,v 1.11 2009/12/23 22:30:17 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -66,8 +66,6 @@ const struct actions man_actions[MAN_MAX] = { { NULL }, /* PD */ }; -static time_t man_atotime(const char *); - int man_action_post(struct man *m) @@ -153,13 +151,18 @@ post_TH(struct man *m) /* TITLE MSEC ->DATE<- SOURCE VOL */ - if (NULL == (n = n->next)) - m->meta.date = time(NULL); - else if (0 == (m->meta.date = man_atotime(n->string))) { - if ( ! man_nwarn(m, n, WDATE)) - return(0); + n = n->next; + if (n) { + m->meta.date = mandoc_a2time + (MTIME_ISO_8601, n->string); + + if (0 == m->meta.date) { + if ( ! man_nwarn(m, n, WDATE)) + return(0); + m->meta.date = time(NULL); + } + } else m->meta.date = time(NULL); - } /* TITLE MSEC DATE ->SOURCE<- VOL */ @@ -192,24 +195,3 @@ post_TH(struct man *m) man_node_freelist(n); return(1); } - - -static time_t -man_atotime(const char *p) -{ - struct tm tm; - char *pp; - - memset(&tm, 0, sizeof(struct tm)); - - if ((pp = strptime(p, "%b %d %Y", &tm)) && 0 == *pp) - return(mktime(&tm)); - if ((pp = strptime(p, "%d %b %Y", &tm)) && 0 == *pp) - return(mktime(&tm)); - if ((pp = strptime(p, "%b %d, %Y", &tm)) && 0 == *pp) - return(mktime(&tm)); - if ((pp = strptime(p, "%b %Y", &tm)) && 0 == *pp) - return(mktime(&tm)); - - return(0); -} |