Changeset 343
- Timestamp:
- Jun 1, 2011, 6:45:19 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_unix.c
r321 r343 2317 2317 else /* have a timeserver address */ 2318 2318 { 2319 /* don't call timeserver more than once per second */ 2320 static time_t time_old = 0; 2321 time_t time_new; 2322 static time_t time_saved = 0; 2323 (void) time (&time_new); 2324 if ((time_new == time_old) && (time_saved != 0)) 2325 { 2326 time_now = time_saved; 2327 goto end; 2328 } 2329 time_old = time_new; 2330 2331 2319 2332 fd = connect_port_2 (sh.srvtime.name, sh.srvtime.alt, 2320 2333 IPPORT_TIMESERVER, … … 2345 2358 memcpy(&ttmp, net_time, sizeof(UINT32)); ltmp = ttmp; 2346 2359 time_now = ntohl(ltmp) - UNIXEPOCH; 2347 /* fprintf(stderr, "TIME IS %ld\n", time_now); */ 2360 time_saved = time_now; 2361 2348 2362 if (failerr == 1) { 2349 2363 failerr = 0; … … 2356 2370 { 2357 2371 (void) time (&time_now); 2372 time_saved = 0; 2373 2358 2374 if (failerr == 0) 2359 2375 { … … 2364 2380 } 2365 2381 } 2382 end: 2383 ; /* 'label at end of compound statement' */ 2366 2384 } 2367 2385 }
Note:
See TracChangeset
for help on using the changeset viewer.