diff options
author | Werner Koch <[email protected]> | 2015-04-10 10:02:31 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-04-10 11:09:37 +0000 |
commit | f6670100b7a15b2071c2e4062f5c5a678f2a30f6 (patch) | |
tree | f57d1fb5b07ab9bc6d1242d8768c65d711676b83 /common/gettime.h | |
parent | dirmngr,w32: Avoid name clash with existing function (diff) | |
download | gnupg-f6670100b7a15b2071c2e4062f5c5a678f2a30f6.tar.gz gnupg-f6670100b7a15b2071c2e4062f5c5a678f2a30f6.zip |
common: Add new function isodate_human_to_tm
* common/gettime.c (isotime_human_p): Add arg date_only.
(isodate_human_to_tm): New.
* common/t-gettime.c (test_isodate_human_to_tm): New.
(main): Call new test.
--
This function in intended as replacement for
strptime (foo, "%Y-%m-%d", &bar)
which is not available under Windows.
Diffstat (limited to 'common/gettime.h')
-rw-r--r-- | common/gettime.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/gettime.h b/common/gettime.h index 10cae17a2..25886d26a 100644 --- a/common/gettime.h +++ b/common/gettime.h @@ -37,10 +37,11 @@ char *elapsed_time_string (time_t since, time_t now); u32 scan_isodatestr (const char *string); int isotime_p (const char *string); -int isotime_human_p (const char *string); +int isotime_human_p (const char *string, int date_only); size_t string2isotime (gnupg_isotime_t atime, const char *string); time_t isotime2epoch (const char *string); void epoch2isotime (gnupg_isotime_t timebuf, time_t atime); +int isodate_human_to_tm (const char *string, struct tm *t); time_t parse_timestamp (const char *timestamp, char **endp); u32 add_days_to_timestamp (u32 stamp, u16 days); const char *strtimevalue (u32 stamp); |