Projects
Browse Source     Search     Timeline     Wiki

Changeset 23369

Show
Ignore:
Timestamp:
09/11/07 13:05:15 (15 months ago)
Author:
zarzycki@…
Message:

<rdar://problem/5418922> modifying the date/time confuses launchd's timers

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/launchd_core_logic.c

    r23368 r23369  
    2424#include <mach/mach.h> 
    2525#include <mach/mach_error.h> 
     26#include <mach/mach_time.h> 
    2627#include <mach/boolean.h> 
    2728#include <mach/message.h> 
     
    349350        int stdout_err_fd; 
    350351        struct timeval sent_sigterm_time; 
    351         time_t start_time; 
    352         time_t min_run_time; 
     352        uint64_t start_time; 
     353        uint32_t min_run_time; 
    353354        unsigned int start_interval; 
    354355        unsigned int checkedin:1, anonymous:1, debug:1, inetcompat:1, inetcompat_wait:1, 
     
    22852286job_start(job_t j) 
    22862287{ 
     2288        static mach_timebase_info_data_t tbi; 
     2289        uint64_t td, tnow = mach_absolute_time(); 
    22872290        int spair[2]; 
    22882291        int execspair[2]; 
     
    22912294        pid_t c; 
    22922295        bool sipc = false; 
    2293         time_t td; 
    22942296        u_int proc_fflags = /* NOTE_EXEC|NOTE_FORK| */ NOTE_EXIT /* |NOTE_REAP */; 
     2297 
     2298        if (tbi.denom == 0) { 
     2299                launchd_assert(mach_timebase_info(&tbi) == 0); 
     2300        } 
    22952301 
    22962302        if (!job_assumes(j, j->mgr != NULL)) { 
     
    23032309        } 
    23042310 
    2305         td = time(NULL) - j->start_time; 
     2311        td = (tnow - j->start_time) * tbi.numer / tbi.denom; 
     2312        td /= NSEC_PER_SEC; 
    23062313 
    23072314        if (td < j->min_run_time && !j->legacy_mach_job && !j->inetcompat) { 
     
    23352342        } 
    23362343 
    2337         time(&j->start_time); 
     2344        j->start_time = tnow; 
    23382345 
    23392346        switch (c = runtime_fork(j->weird_bootstrap ? j->j_port : j->mgr->jm_port)) {