Print this page
4378 Clean up %C in *time() functions
438 need documentation for strftime %s flag

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cron/cron.c
          +++ new/usr/src/cmd/cron/cron.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   *
  25   25   * Copyright 2013 Joshua M. Clulow <josh@sysmgr.org>
       26 + *
       27 + * Copyright (c) 2014 Gary Mills
  26   28   */
  27   29  
  28   30  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  29   31  /*        All Rights Reserved   */
  30   32  
  31   33  /*      Copyright (c) 1987, 1988 Microsoft Corporation  */
  32   34  /*        All Rights Reserved   */
  33   35  
  34   36  #ifdef lint
  35   37  /* make lint happy */
↓ open down ↓ 506 lines elided ↑ open up ↑
 542  544                  t_old = t;
 543  545  
 544  546                  if (next_event == NULL && !el_empty()) {
 545  547                          next_event = (struct event *)el_first();
 546  548                  }
 547  549                  if (next_event == NULL) {
 548  550                          ne_time = INFINITY;
 549  551                  } else {
 550  552                          ne_time = next_event->time - t;
 551  553  #ifdef DEBUG
 552      -                        cftime(timebuf, "%C", &next_event->time);
      554 +                        cftime(timebuf, "%+", &next_event->time);
 553  555                          (void) fprintf(stderr, "next_time=%ld %s\n",
 554  556                              next_event->time, timebuf);
 555  557  #endif
 556  558                  }
 557  559                  if (ne_time > 0) {
 558  560                          /*
 559  561                           * reset_needed may be set in the functions call path
 560  562                           * from idle()
 561  563                           */
 562  564                          if (idle(ne_time) || reset_needed) {
↓ open down ↓ 53 lines elided ↑ open up ↑
 616  618                                   * kicked off!
 617  619                                   */
 618  620                                  next_event->time =
 619  621                                      next_time(next_event, newtime);
 620  622                                  t_old = time(NULL);
 621  623                          } else {
 622  624                                  next_event->time =
 623  625                                      next_time(next_event, (time_t)0);
 624  626                          }
 625  627  #ifdef DEBUG
 626      -                        cftime(timebuf, "%C", &next_event->time);
      628 +                        cftime(timebuf, "%+", &next_event->time);
 627  629                          (void) fprintf(stderr,
 628  630                              "pushing back cron event %s at %ld (%s)\n",
 629  631                              next_event->cmd, next_event->time, timebuf);
 630  632  #endif
 631  633  
 632  634                          switch (el_add(next_event, next_event->time,
 633  635                              (next_event->u)->ctid)) {
 634  636                          case -1:
 635  637                                  ignore_msg("main", "cron", next_event);
 636  638                                  break;
↓ open down ↓ 627 lines elided ↑ open up ↑
1264 1266                  switch (el_add(e, e->time, u->ctid)) {
1265 1267                  case -1:
1266 1268                          ignore_msg("readcron", "cron", e);
1267 1269                          break;
1268 1270                  case -2: /* event time lower than init time */
1269 1271                          reset_needed = 1;
1270 1272                          break;
1271 1273                  }
1272 1274                  cte_valid();
1273 1275  #ifdef DEBUG
1274      -                cftime(timebuf, "%C", &e->time);
     1276 +                cftime(timebuf, "%+", &e->time);
1275 1277                  (void) fprintf(stderr, "inserting cron event %s at %ld (%s)\n",
1276 1278                      e->cmd, e->time, timebuf);
1277 1279  #endif
1278 1280          }
1279 1281          cte_sendmail(u->name);  /* mail errors if any to user */
1280 1282          (void) fclose(cf);
1281 1283          rel_shared(tz);
1282 1284          rel_shared(shell);
1283 1285          rel_shared(home);
1284 1286  }
↓ open down ↓ 2377 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX