To complement the testability of approxidate. Signed-off-by: Alex Riesen <raa.lkml@xxxxxxxxx> --- Alex Riesen, Sun, Aug 30, 2009 11:13:46 +0200: > test-date.c is updated and shall follow in a moment. here it goes. test-date.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/test-date.c b/test-date.c index 62e8f23..4cb146d 100644 --- a/test-date.c +++ b/test-date.c @@ -4,6 +4,19 @@ int main(int argc, char **argv) { int i; + /* see date.c, function show_date_relative */ + char timebuf[(sizeof(long) * 5 / 2 + sizeof(" minutes ago,")) * 2]; + struct tm tm; + struct timeval when = {0, 0}; + tm.tm_sec = 0; + tm.tm_min = 0; + tm.tm_hour = 12; + tm.tm_mday = 1; + tm.tm_mon = 0 /* January */; + tm.tm_year = 90 /* 1990 */ ; + tm.tm_isdst = -1; + when.tv_sec = mktime(&tm); + for (i = 1; i < argc; i++) { char result[100]; time_t t; @@ -15,6 +28,13 @@ int main(int argc, char **argv) t = approxidate(argv[i]); printf("%s -> %s\n", argv[i], ctime(&t)); + + t = approxidate_relative(argv[i], &when); + printf("relative: %s -> %s", argv[i], ctime(&t)); + + printf("relative: %s, out of %s", + show_date_relative(t, 0, &when, timebuf,sizeof(timebuf)), + ctime(&t)); } return 0; } -- 1.6.4.1.294.g16262 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html