Mercurial > pt1
changeset 48:c8051f6da2ab
now recpt1 accepts formats like 1:20:05 (hh:mm:ss) or 1:20 (hh:mm).
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sun, 19 Jul 2009 05:24:39 +0900 |
parents | edd904628e2f |
children | 6bcdd17c12f6 |
files | recpt1/recpt1.c |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/recpt1/recpt1.c Sun Jul 19 04:55:44 2009 +0900 +++ b/recpt1/recpt1.c Sun Jul 19 05:24:39 2009 +0900 @@ -705,10 +705,20 @@ /* get recsec */ char *rectimestr = argv[optind + 1]; + /* indefinite */ if(!strcmp("-", rectimestr)) { indefinite = TRUE; recsec = -1; } + /* colon */ + else if(strchr(rectimestr, ':')) { + int n1, n2, n3; + if(sscanf(rectimestr, "%d:%d:%d", &n1, &n2, &n3) == 3) + recsec = n1 * 3600 + n2 * 60 + n3; + else if(sscanf(rectimestr, "%d:%d", &n1, &n2) == 2) + recsec = n1 * 3600 + n2 * 60; + } + /* HMS */ else { char *tmpstr; char *p1, *p2; @@ -742,6 +752,8 @@ free(tmpstr); } + /* fprintf(stderr, "recsec = %d\n", recsec); */ + /* open output file */ char *destfile = argv[optind + 2]; if(destfile && !strcmp("-", destfile)) {