summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-02-23 11:05:07 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-02-23 11:05:07 -0600
commitadd4b0c53df1826607921bf79c6fabaf84fdeb75 (patch)
tree2c0f26cff950b07233d0687777dfa8d113f87b89
parent33be1d058f7e3e0323286d3a879ad48e85e05274 (diff)
downloadnuttx-add4b0c53df1826607921bf79c6fabaf84fdeb75.tar.gz
nuttx-add4b0c53df1826607921bf79c6fabaf84fdeb75.tar.bz2
nuttx-add4b0c53df1826607921bf79c6fabaf84fdeb75.zip
sfrtime: Missing implementation of %C (was being treated as %y). From Freddie Chopin
-rw-r--r--nuttx/libc/time/lib_strftime.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/nuttx/libc/time/lib_strftime.c b/nuttx/libc/time/lib_strftime.c
index 3eae8e019..e9e52ed84 100644
--- a/nuttx/libc/time/lib_strftime.c
+++ b/nuttx/libc/time/lib_strftime.c
@@ -1,7 +1,7 @@
/****************************************************************************
* libc/time/lib_strftime.c
*
- * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2011, 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -210,12 +210,16 @@ size_t strftime(FAR char *s, size_t max, FAR const char *format,
/* %y: The year as a decimal number without a century (range 00 to 99). */
case 'y':
+ {
+ len = snprintf(dest, chleft, "%02d", tm->tm_year % 100);
+ }
+ break;
/* %C: The century number (year/100) as a 2-digit integer. */
case 'C':
{
- len = snprintf(dest, chleft, "%02d", tm->tm_year % 100);
+ len = snprintf(dest, chleft, "%02d", tm->tm_year / 100);
}
break;