(str2time_t): fix end-of-day logic, from Duncan McEwan/Mark Davies.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13840 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
2004-05-07 09:03:31 +00:00
parent e24a5cf820
commit efe1bcc986

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997 - 2002 Kungliga Tekniska H<>gskolan
* Copyright (c) 1997 - 2004 Kungliga Tekniska H<>gskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -194,15 +194,18 @@ str2time_t (const char *str, time_t *t)
if (p == NULL)
return -1;
/* Do it on the end of the day */
tm2.tm_hour = 23;
tm2.tm_min = 59;
tm2.tm_sec = 59;
/* XXX this is really a bit optimistic, we should really complain
if there was a problem parsing the time */
if(strptime (p, "%t%H:%M:%S", &tm2) != NULL) {
tm.tm_hour = tm2.tm_hour;
tm.tm_min = tm2.tm_min;
tm.tm_sec = tm2.tm_sec;
} else {
/* Do it on the end of the day */
tm.tm_hour = 23;
tm.tm_min = 59;
tm.tm_sec = 59;
}
*t = tm2time (tm, 0);