Bacula-users

Re: [Bacula-users] Howto recover from a job being rerun around a summer time change

2009-04-07 14:11:12
Subject: Re: [Bacula-users] Howto recover from a job being rerun around a summer time change
From: Kevin Keane <subscription AT kkeane DOT com>
Date: Tue, 7 Apr 2009 11:04:38 -0700
Foo wrote:
> On Mon, 06 Apr 2009 19:41:52 +0200, Martin Simmons <martin AT lispworks DOT 
> com>  
> wrote:
>
>   
>>>>>>> On Mon, 06 Apr 2009 17:34:09 +0200, Foo  said:
>>>>>>>               
>>> The best solution would be for Bacula to translate time to UTC  
>>> internally
>>> for scheduling, everything external such as logfiles, scheduling stanzas
>>> in config etc. would remain in the user's locale.
>>>       
>> That doesn't help, because saying 2:05am local time in the config file is
>> still ambiguous if the local time moves backwards by 1 hour at 3:00am.
>>     
>
> Not really, UTC remains the same on DST changes, so internal events using  
> UTC should be fine.
>
> Basically on startup Bacula needs to check the locale, get the offset from  
> UTC, if any, and set its internal clock to UTC, and change the offset on  
> DST changes. Then use the offset for calculations involving configs/user  
> output like logging.
>
>   
>> To resolve this, Bacula would have to use UTC in the config file as well.
>>     
>
> See above.
>
>   
>> Alternatively, it would need some non-trivial code to deal with the
>> duplicate/missing local times.
>>     
>
> I don't see how this is not trivial code. I would assume some standard  
> library/system clock routines are used for time, just put a filter routine  
> in between and call that instead (hopefully this should be a search and  
> replace in the code).
>   
Yeah, I think it shouldn't be too difficult. I assume that there is a 
dispatcher routine somewhere that gets called once a minute or so. 
Simply keep track of the time it was last called.

Pseudocode:

void dispatchEvents() {
   static time lastDispatchTime = 0; // probably 1/1/1970
   time currentTime = getCurrentTime();

   // we need to initialize lastDispatchTime, or else we would later 
call everything
   // due to happen since 1970!
   if (lastDispatchTime == 0)
     lastDispatchTime = currentTime - 1 minute;

   if (currentTime < lastDispatchTime) {
      // do nothing. We are in the duplicate hour in spring.
   } else {
      // identify all events that were scheduled between 
lastDispatchTime and currentTime.
      // This will execute everything due to happen in the last minute, 
and also anything scheduled
      // for the missing hour. in fall.
      lastDispatchTime = currentTime;
   }
}


-- 
Kevin Keane
Owner
The NetTech
Find the Uncommon: Expert Solutions for a Network You Never Have to Think About

Office: 866-642-7116
http://www.4nettech.com

This e-mail and attachments, if any, may contain confidential and/or 
proprietary information. Please be advised that the unauthorized use or 
disclosure of the information is strictly prohibited. The information herein is 
intended only for use by the intended recipient(s) named above. If you have 
received this transmission in error, please notify the sender immediately and 
permanently delete the e-mail and any copies, printouts or attachments thereof.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>