(gettime): use `parse_time'
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2615 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -37,32 +37,13 @@ | |||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "admin_locl.h" | #include "admin_locl.h" | ||||||
| #if defined (HAVE_SYS_TIMEB_H) | #include <parse_time.h> | ||||||
| #include <sys/timeb.h> |  | ||||||
| #else |  | ||||||
|  |  | ||||||
| /* get_date uses the obsolete `struct timeb' in its interface!  FIXME. |  | ||||||
|    Since some systems don't have it, we define it here; |  | ||||||
|    callers must do likewise.  */ |  | ||||||
| struct timeb |  | ||||||
|   { |  | ||||||
|     time_t		time;		/* Seconds since the epoch	*/ |  | ||||||
|     unsigned short	millitm;	/* Field not used		*/ |  | ||||||
|     short		timezone;	/* Minutes west of GMT		*/ |  | ||||||
|     short		dstflag;	/* Field not used		*/ |  | ||||||
| }; |  | ||||||
| #endif /* defined (HAVE_SYS_TIMEB_H) */ |  | ||||||
|  |  | ||||||
| time_t  | time_t  | ||||||
| gettime(const char *prompt, const char *def, int relative) | gettime(const char *prompt, const char *def) | ||||||
| { | { | ||||||
|     char buf[1024]; |     char buf[1024]; | ||||||
|     time_t t; |     time_t t; | ||||||
|     struct timeb now, *tp = NULL; |  | ||||||
|     if(relative){ |  | ||||||
| 	memset(&now, 0, sizeof(now)); |  | ||||||
| 	tp = &now; |  | ||||||
|     } |  | ||||||
|     while(1){ |     while(1){ | ||||||
| 	printf("%s", prompt); | 	printf("%s", prompt); | ||||||
| 	if(def) | 	if(def) | ||||||
| @@ -74,7 +55,7 @@ gettime(const char *prompt, const char *def, int relative) | |||||||
| 	if(def && buf[0] == 0) strcpy(buf, def); | 	if(def && buf[0] == 0) strcpy(buf, def); | ||||||
| 	if(strcmp(buf, "infinite") == 0 || strcmp(buf, "unlimited") == 0) | 	if(strcmp(buf, "infinite") == 0 || strcmp(buf, "unlimited") == 0) | ||||||
| 	    return 0; | 	    return 0; | ||||||
| 	t = get_date(buf, tp); | 	t = parse_time (buf, NULL); | ||||||
| 	if(t != -1) | 	if(t != -1) | ||||||
| 	    return t; | 	    return t; | ||||||
| 	printf("Unrecognised time.\n"); | 	printf("Unrecognised time.\n"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Assar Westerlund
					Assar Westerlund