Skip to content

Commit

Permalink
s format
Browse files Browse the repository at this point in the history
SCCS-file: strftime.c
SCCS-SID: 7.45
  • Loading branch information
Arthur David Olson authored and eggert committed Jul 18, 2012
1 parent 6fdcf34 commit 1efa2d6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions strftime.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,25 @@ const char * const ptlim;
case 'S':
pt = _conv(t->tm_sec, "%02d", pt, ptlim);
continue;
case 's':
{
struct tm tm;
char buf[INT_STRLEN_MAXIMUM(
time_t) + 1];

tm = *t;
(void) sprintf(buf,
#if ((time_t) -1) < 0 /* if time_t is signed */
"%ld", (long)
#endif /* time_t is signed */
#if ((time_t) -1) >= 0 /* if time_t is unsigned */
"%lu", (unsigned long)
#endif /* time_t is signed */

mktime(&tm));
pt = _add(buf, pt, ptlim);
}
continue;
case 'T':
pt = _fmt("%H:%M:%S", t, pt, ptlim);
continue;
Expand Down

0 comments on commit 1efa2d6

Please sign in to comment.