diff options
| author | Paul Eggert | 2011-01-30 15:34:18 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-01-30 15:34:18 -0800 |
| commit | 16c3e636a68cf74386d3d4d582a3a189b84d700c (patch) | |
| tree | 43ef51bef626bf3b4c4d578e8dce0ad9857e98df /src/editfns.c | |
| parent | 4eec7f8b2b465c6fc2c09d37d4da2b540f607df0 (diff) | |
| download | emacs-16c3e636a68cf74386d3d4d582a3a189b84d700c.tar.gz emacs-16c3e636a68cf74386d3d4d582a3a189b84d700c.zip | |
strftime: import from gnulib
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/editfns.c b/src/editfns.c index a5f39870000..7364a5bcf15 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -45,6 +45,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | #endif | 45 | #endif |
| 46 | 46 | ||
| 47 | #include <ctype.h> | 47 | #include <ctype.h> |
| 48 | #include <strftime.h> | ||
| 48 | 49 | ||
| 49 | #include "intervals.h" | 50 | #include "intervals.h" |
| 50 | #include "buffer.h" | 51 | #include "buffer.h" |
| @@ -82,9 +83,6 @@ extern char **environ; | |||
| 82 | (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) | 83 | (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) |
| 83 | #endif | 84 | #endif |
| 84 | 85 | ||
| 85 | extern size_t emacs_strftimeu (char *, size_t, const char *, | ||
| 86 | const struct tm *, int); | ||
| 87 | |||
| 88 | #ifdef WINDOWSNT | 86 | #ifdef WINDOWSNT |
| 89 | extern Lisp_Object w32_get_internal_run_time (void); | 87 | extern Lisp_Object w32_get_internal_run_time (void); |
| 90 | #endif | 88 | #endif |
| @@ -1556,8 +1554,8 @@ or (if you need time as a string) `format-time-string'. */) | |||
| 1556 | determine how many bytes would be written, use NULL for S and | 1554 | determine how many bytes would be written, use NULL for S and |
| 1557 | ((size_t) -1) for MAXSIZE. | 1555 | ((size_t) -1) for MAXSIZE. |
| 1558 | 1556 | ||
| 1559 | This function behaves like emacs_strftimeu, except it allows null | 1557 | This function behaves like nstrftime, except it allows null |
| 1560 | bytes in FORMAT. */ | 1558 | bytes in FORMAT and it does not support nanoseconds. */ |
| 1561 | static size_t | 1559 | static size_t |
| 1562 | emacs_memftimeu (char *s, size_t maxsize, const char *format, size_t format_len, const struct tm *tp, int ut) | 1560 | emacs_memftimeu (char *s, size_t maxsize, const char *format, size_t format_len, const struct tm *tp, int ut) |
| 1563 | { | 1561 | { |
| @@ -1566,7 +1564,7 @@ emacs_memftimeu (char *s, size_t maxsize, const char *format, size_t format_len, | |||
| 1566 | /* Loop through all the null-terminated strings in the format | 1564 | /* Loop through all the null-terminated strings in the format |
| 1567 | argument. Normally there's just one null-terminated string, but | 1565 | argument. Normally there's just one null-terminated string, but |
| 1568 | there can be arbitrarily many, concatenated together, if the | 1566 | there can be arbitrarily many, concatenated together, if the |
| 1569 | format contains '\0' bytes. emacs_strftimeu stops at the first | 1567 | format contains '\0' bytes. nstrftime stops at the first |
| 1570 | '\0' byte so we must invoke it separately for each such string. */ | 1568 | '\0' byte so we must invoke it separately for each such string. */ |
| 1571 | for (;;) | 1569 | for (;;) |
| 1572 | { | 1570 | { |
| @@ -1576,7 +1574,7 @@ emacs_memftimeu (char *s, size_t maxsize, const char *format, size_t format_len, | |||
| 1576 | if (s) | 1574 | if (s) |
| 1577 | s[0] = '\1'; | 1575 | s[0] = '\1'; |
| 1578 | 1576 | ||
| 1579 | result = emacs_strftimeu (s, maxsize, format, tp, ut); | 1577 | result = nstrftime (s, maxsize, format, tp, ut, 0); |
| 1580 | 1578 | ||
| 1581 | if (s) | 1579 | if (s) |
| 1582 | { | 1580 | { |