You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/18 13:30:49 UTC

[GitHub] [incubator-nuttx] fjpanag opened a new pull request, #7348: strftime: Added support for the %w format specifier.

fjpanag opened a new pull request, #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348

   ## Summary
   
   Enhanced `strftime()` with support for the `%w` format specifier.
   
   ## Impact
   
   New functionality.
   
   ## Testing
   
   Tested prints on simulator.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] acassis commented on pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
acassis commented on PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348#issuecomment-1282855612

   @fjpanag : man strftime:
   %w     The  day  of  the  week  as  a  decimal, range 0 to 6, Sunday being 0. 
   
   Should be 0 to 6, not 00 to 06, please fix!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] acassis commented on a diff in pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
acassis commented on code in PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348#discussion_r998592967


##########
libs/libc/time/lib_strftime.c:
##########
@@ -398,6 +399,14 @@ size_t strftime(FAR char *s, size_t max, FAR const char *format,
              }
              break;
 
+           /* %w: The weekday as a decimal number (range 00 to 06). */
+
+           case 'w':
+             {
+               len = snprintf(dest, chleft, "%02d", tm->tm_wday);

Review Comment:
   ```suggestion
                  len = snprintf(dest, chleft, "%d", tm->tm_wday);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] fjpanag closed pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
fjpanag closed pull request #7348: strftime: Added support for the %w format specifier.
URL: https://github.com/apache/incubator-nuttx/pull/7348


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] fjpanag commented on pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
fjpanag commented on PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348#issuecomment-1283132885

   > 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] acassis commented on a diff in pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
acassis commented on code in PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348#discussion_r998592967


##########
libs/libc/time/lib_strftime.c:
##########
@@ -398,6 +399,14 @@ size_t strftime(FAR char *s, size_t max, FAR const char *format,
              }
              break;
 
+           /* %w: The weekday as a decimal number (range 00 to 06). */
+
+           case 'w':
+             {
+               len = snprintf(dest, chleft, "%02d", tm->tm_wday);

Review Comment:
   ```suggestion
                  len = snprintf(dest, chleft, "%01d", tm->tm_wday);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] fjpanag commented on pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
fjpanag commented on PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348#issuecomment-1283133904

   > @fjpanag : man strftime: `%w The day of the week as a decimal, range 0 to 6, Sunday being 0.`
   > 
   > Should be 0 to 6, not 00 to 06, please fix!
   
   I was pretty sure that I saw it formatted with two-digits, but apparently your are correct.  
   Fixed!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] fjpanag commented on pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
fjpanag commented on PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348#issuecomment-1283134100

   > @fjpanag : man strftime: `%w The day of the week as a decimal, range 0 to 6, Sunday being 0.`
   > 
   > Should be 0 to 6, not 00 to 06, please fix!
   
   I was pretty sure that I saw it formatted with two-digits, but apparently your are correct.  
   Fixed!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] acassis commented on pull request #7348: strftime: Added support for the %w format specifier.

Posted by GitBox <gi...@apache.org>.
acassis commented on PR #7348:
URL: https://github.com/apache/incubator-nuttx/pull/7348#issuecomment-1282855961

   Tested on Linux:
   ```
   #include <stdio.h>
   #include <time.h>
   
   int main () {
      time_t rawtime;
      struct tm *info;
      char buffer[80];
   
      time( &rawtime );
   
      info = localtime( &rawtime );
   
      strftime(buffer,80,"%x - %I:%M%p wday=%w", info);
      printf("Formatted date & time : |%s|\n", buffer );
   
      return(0);
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org