summaryrefslogtreecommitdiffstats
path: root/man_action.c
diff options
context:
space:
mode:
Diffstat (limited to 'man_action.c')
-rw-r--r--man_action.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/man_action.c b/man_action.c
index 19e11e39..aa56dda6 100644
--- a/man_action.c
+++ b/man_action.c
@@ -66,11 +66,6 @@ const struct actions man_actions[MAN_MAX] = {
{ NULL }, /* PD */
};
-static time_t man_atotime(const char *);
-#ifdef __linux__
-extern char *strptime(const char *, const char *, struct tm *);
-#endif
-
int
man_action_post(struct man *m)
@@ -156,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 */
@@ -195,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);
-}