HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

bugfix: expire time (-k option) calculation




The time conversion for expiry time (LASTTIME job parm) is wrong for
times longer than 24 hours. If you specify 25 hours, it'll give you 49
hours, and report that it has given you 97 hours.

The following patches fix it.


*** faxalter/faxalter.c++.orig	Tue Dec 23 16:16:07 1997
--- faxalter/faxalter.c++	Mon Jul 13 19:55:37 1998
***************
*** 103,109 ****
  	    { time_t tv = mktime(&when) - now;
  	      addToScript("LASTTIME %02d%02d%02d"
  		, tv/(24*60*60)
! 		, (tv/(60*60))%60
  		, (tv/60)%60
  	      );
  	    }
--- 103,109 ----
  	    { time_t tv = mktime(&when) - now;
  	      addToScript("LASTTIME %02d%02d%02d"
  		, tv/(24*60*60)
! 		, (tv/(60*60))%24
  		, (tv/60)%60
  	      );
  	    }
*** hfaxd/Jobs.c++.orig	Tue Dec 23 16:18:51 1997
--- hfaxd/Jobs.c++	Mon Jul 13 19:55:57 1998
***************
*** 360,366 ****
  	return;
      case T_LASTTIME:
  	time_t tv; tv = job.killtime - job.tts;		// XXX for __GNUC__
! 	reply(code, "%02d%02d%02d", tv/(24*60*60), (tv/(60*60))%60, (tv/60)%60);
  	return;
      case T_RETRYTIME:
  	reply(code, "%02d%02d", job.retrytime/60, job.retrytime%60);
--- 360,366 ----
  	return;
      case T_LASTTIME:
  	time_t tv; tv = job.killtime - job.tts;		// XXX for __GNUC__
! 	reply(code, "%02d%02d%02d", tv/(24*60*60), (tv/(60*60))%24, (tv/60)%60);
  	return;
      case T_RETRYTIME:
  	reply(code, "%02d%02d", job.retrytime/60, job.retrytime%60);
***************
*** 489,495 ****
      if (checkAccess(job, T_LASTTIME, A_READ)) {
  	time_t tv = job.killtime - job.tts;
  	jstatLine(T_LASTTIME, "%02d%02d%02d",
! 	    tv/(24*60*60), (tv/(60*60))%60, (tv/60)%60);
      }
      if (checkAccess(job, T_RETRYTIME, A_READ))
  	jstatLine(T_RETRYTIME, "%02d%02d", job.retrytime/60, job.retrytime%60);
--- 489,495 ----
      if (checkAccess(job, T_LASTTIME, A_READ)) {
  	time_t tv = job.killtime - job.tts;
  	jstatLine(T_LASTTIME, "%02d%02d%02d",
! 	    tv/(24*60*60), (tv/(60*60))%24, (tv/60)%60);
      }
      if (checkAccess(job, T_RETRYTIME, A_READ))
  	jstatLine(T_RETRYTIME, "%02d%02d", job.retrytime/60, job.retrytime%60);
*** hfaxd/Parser.c++.orig	Tue Dec 23 16:18:56 1997
--- hfaxd/Parser.c++	Mon Jul 13 19:56:09 1998
***************
*** 1035,1041 ****
  	    reply(213, "%s set to %02d%02d%02d."
  		, parmToken(t)
  		, ticks/(24*60*60)
! 		, (ticks/(60*60))%60
  		, (ticks/60)%60
  	    );
  	    return (TRUE);
--- 1035,1041 ----
  	    reply(213, "%s set to %02d%02d%02d."
  		, parmToken(t)
  		, ticks/(24*60*60)
! 		, (ticks/(60*60))%24
  		, (ticks/60)%60
  	    );
  	    return (TRUE);
*** hfaxd/SNPPServer.c++.orig	Tue Dec 23 16:18:57 1997
--- hfaxd/SNPPServer.c++	Mon Jul 13 19:56:24 1998
***************
*** 753,762 ****
      case T_LASTTIME:			// time to kill job
  	if (timespec_param(6, tv) && setJobParameter(defJob, t, tv)) {
  	    logcmd(t, "%02d%02d%02d"
! 		, tv/(24*60*60) , (tv/(60*60))%60 , (tv/60)%60);
  	    reply(250, "%s set to %02d%02d%02d."
  		, parmToken(t)
! 		, tv/(24*60*60) , (tv/(60*60))%60 , (tv/60)%60);
  	    return (TRUE);
  	}
  	break;
--- 753,762 ----
      case T_LASTTIME:			// time to kill job
  	if (timespec_param(6, tv) && setJobParameter(defJob, t, tv)) {
  	    logcmd(t, "%02d%02d%02d"
! 		, tv/(24*60*60) , (tv/(60*60))%24 , (tv/60)%60);
  	    reply(250, "%s set to %02d%02d%02d."
  		, parmToken(t)
! 		, tv/(24*60*60) , (tv/(60*60))%24 , (tv/60)%60);
  	    return (TRUE);
  	}
  	break;
*** util/FaxClient.c++.orig	Tue Dec 23 16:22:45 1997
--- util/FaxClient.c++          Mon Jul 13 19:56:41 1998
***************
*** 859,865 ****
  FaxClient::jobLastTime(u_long tv)
  {
      return (command("JPARM LASTTIME %02d%02d%02d",
! 	tv/(24*60*60), (tv/(60*60))%60, (tv/60)%60) == COMPLETE);
  }
  fxBool
  FaxClient::jobRetryTime(u_long tv)
--- 859,865 ----
  FaxClient::jobLastTime(u_long tv)
  {
      return (command("JPARM LASTTIME %02d%02d%02d",
! 	tv/(24*60*60), (tv/(60*60))%24, (tv/60)%60) == COMPLETE);
  }
  fxBool
  FaxClient::jobRetryTime(u_long tv)


--
Trevor Blackwell         tlb@yahoo-inc.com          (617) 876-2692 x982
http://store.yahoo.com/




Project hosted by iFAX Solutions