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/lib/libfru/libnvfru/nvfru.c
          +++ new/usr/src/lib/libfru/libnvfru/nvfru.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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  /*
       23 + * Copyright (c) 2014 Gary Mills
       24 + *
  23   25   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24   26   */
  25   27  
  26   28  #include <stdio.h>
  27   29  #include <stdlib.h>
  28   30  #include <stdint.h>
  29   31  #include <strings.h>
  30   32  #include <assert.h>
  31   33  #include <pthread.h>
  32   34  #include <sys/byteorder.h>
↓ open down ↓ 33 lines elided ↑ open up ↑
  66   68                  assert(def->payloadLen <= sizeof (value));
  67   69                  switch (def->dispType) {
  68   70  #if PARSE_TIME == 1
  69   71                  case FDISP_Time:
  70   72                          if (def->payloadLen > sizeof (timefield)) {
  71   73                                  /* too big for formatting */
  72   74                                  return;
  73   75                          }
  74   76                          (void) memcpy(&timefield, field, sizeof (timefield));
  75   77                          timefield = BE_32(timefield);
  76      -                        if (strftime(timestring, sizeof (timestring), "%C",
       78 +                        if (strftime(timestring, sizeof (timestring), "%c",
  77   79                              localtime(&timefield)) == 0) {
  78   80                                  /* buffer too small */
  79   81                                  return;
  80   82                          }
  81   83                          (void) nvlist_add_string(nv, path, timestring);
  82   84                          return;
  83   85  #endif
  84   86  
  85   87                  case FDISP_Binary:
  86   88                  case FDISP_Octal:
↓ open down ↓ 322 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX