avr-libc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-commit] [2363] strftime now handles all standard conversions,


From: Mike Rice
Subject: [avr-libc-commit] [2363] strftime now handles all standard conversions, in the C locale.
Date: Sat, 27 Apr 2013 15:27:21 +0000

Revision: 2363
          http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2363
Author:   swfltek
Date:     2013-04-27 15:27:15 +0000 (Sat, 27 Apr 2013)
Log Message:
-----------
strftime now handles all standard conversions, in the C locale. 'Z' is ignored 
(no time zone name available).

Modified Paths:
--------------
    trunk/avr-libc/libc/time/strftime.c

Modified: trunk/avr-libc/libc/time/strftime.c
===================================================================
--- trunk/avr-libc/libc/time/strftime.c 2013-04-26 22:22:46 UTC (rev 2362)
+++ trunk/avr-libc/libc/time/strftime.c 2013-04-27 15:27:15 UTC (rev 2363)
@@ -158,6 +158,24 @@
                     );
                 break;
 
+            case ('g'):
+                       case ('G'):
+                               d = timeptr->tm_year + 1900;
+                               w = iso_weeknum(timeptr);
+                               if (w == 0)
+                                       d--;
+                               if (w == 54)
+                                       d++;
+
+                               if (c == 'g') {
+                                       d %= 100;
+                                       length = sprintf(_store, "%.2d", d);
+                               } else {
+                                       length = sprintf(_store, "%.4d", d);
+                               }
+
+                               break;
+
             case ('H'):
                 length = sprintf(_store, "%.2u", timeptr->tm_hour);
                 break;
@@ -239,6 +257,15 @@
                 length = sprintf(_store, "%.2u", week_of_year(timeptr, 0));
                 break;
 
+                       case ('V'):
+                               w = iso_weeknum(timeptr);
+                               if (w == 0)
+                                       w = 53;
+                               if (w == 54)
+                                       w = 1;
+                               length = sprintf(_store, "%.2u", w);
+                               break;
+
             case ('w'):
                 length = sprintf(_store, "%u", timeptr->tm_wday);
                 break;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]