diff options
Diffstat (limited to 'time')
-rw-r--r-- | time/strftime.c | 14 | ||||
-rw-r--r-- | time/time.h | 2 |
2 files changed, 13 insertions, 3 deletions
diff --git a/time/strftime.c b/time/strftime.c index 963e9e4e4d..4afcdd20fb 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -229,6 +229,11 @@ static const char spaces[16] = " "; # define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch)) # define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) #endif +/* We don't use `isdigit' here since the locale dependent + interpretation is not what we want here. We only need to accept + the arabic digits in the ASCII range. One day there is perhaps a + more reliable way to accept other sets of digits. */ +#define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9) static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len)); @@ -487,17 +492,19 @@ strftime (s, maxsize, format, tp) #endif /* ! DO_MULTIBYTE */ - /* Check for flags that can modify a number format. */ + /* Check for flags that can modify a format. */ while (1) { switch (*++f) { + /* This influences the number formats. */ case '_': case '-': case '0': pad = *f; continue; + /* This changes textual output. */ case '^': to_uppcase = 1; continue; @@ -510,15 +517,16 @@ strftime (s, maxsize, format, tp) } /* As a GNU extension we allow to specify the field width. */ - if (isdigit (*f)) + if (ISDIGIT (*f)) { width = 0; do { width *= 10; width += *f - '0'; + ++f; } - while (isdigit (*++f)); + while (ISDIGIT (*f)); } /* Check for modifiers. */ diff --git a/time/time.h b/time/time.h index e824e64b9d..d12236fdf2 100644 --- a/time/time.h +++ b/time/time.h @@ -48,8 +48,10 @@ __BEGIN_DECLS /* This is the obsolete POSIX.1-1988 name for the same constant. */ #ifdef __USE_POSIX +#ifndef CLK_TCK #define CLK_TCK CLOCKS_PER_SEC #endif +#endif #endif /* <time.h> included. */ |