diff options
author | Jeremy Allison <jra@samba.org> | 2001-03-27 03:16:05 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-03-27 03:16:05 +0000 |
commit | 524619561a776161e4fa0d82f1de0666e8dac553 (patch) | |
tree | 7f62b2161af2e90311c8a7bafdc6339f4822cbea /source3/printing | |
parent | 303c152f03c5cb4a8872673b548a7ee4caae2eb3 (diff) | |
download | samba-524619561a776161e4fa0d82f1de0666e8dac553.tar.gz samba-524619561a776161e4fa0d82f1de0666e8dac553.tar.bz2 samba-524619561a776161e4fa0d82f1de0666e8dac553.zip |
Patch from itegem <J.P.M.v.Itegem@ele.tue.nl> to handle LPRng v3.16 and above.
Jeremy
(This used to be commit 40bccf26dbdb88c639d272d511bfce510a43de2a)
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/lpq_parse.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index f6bf7f06df..a143709570 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -183,20 +183,39 @@ the lpq output. The lpq time looks like "23:15:07" <allan@umich.edu> June 30, 1998. Modified to work with the re-written parse_lpq_lprng routine. + +<J.P.M.v.Itegem@tue.nl> Dec 17,1999 +Modified to work with lprng 3.16 +With lprng 3.16 The lpq time looks like + "23:15:07" + "23:15:07.100" + "1999-12-16-23:15:07" + "1999-12-16-23:15:07.100" + */ static time_t LPRng_time(char *time_string) { - time_t jobtime; - struct tm *t; - - jobtime = time(NULL); /* default case: take current time */ - t = localtime(&jobtime); - t->tm_hour = atoi(time_string); - t->tm_min = atoi(time_string+3); - t->tm_sec = atoi(time_string+6); - jobtime = mktime(t); - - return jobtime; + time_t jobtime; + struct tm t; + + jobtime = time(NULL); /* default case: take current time */ + t = *localtime(&jobtime); + + if ( atoi(time_string) < 24 ){ + t.tm_hour = atoi(time_string); + t.tm_min = atoi(time_string+3); + t.tm_sec = atoi(time_string+6); + } else { + t.tm_year = atoi(time_string)-1900; + t.tm_mon = atoi(time_string+5)-1; + t.tm_mday = atoi(time_string+8); + t.tm_hour = atoi(time_string+11); + t.tm_min = atoi(time_string+14); + t.tm_sec = atoi(time_string+17); + } + jobtime = mktime(&t); + + return jobtime; } |