if (dplace == 4) /* shift values having only 4 decimal places */
read_tv->tv_usec *= 100; /* and need for 6 */
+ if (dplace == 5) /* shift values having only 5 decimal places */
+ read_tv->tv_usec *= 10; /* and need for 6 */
+
if (timestamps == 'a') { /* absolute */
tv->tv_sec = date_tv->tv_sec + read_tv->tv_sec;
static struct timeval tv; /* current frame timestamp */
static struct timeval read_tv; /* frame timestamp from ASC file */
static struct timeval date_tv; /* date of the ASC file */
- static int dplace; /* decimal place 4 or 6 or uninitialized */
+ static int dplace; /* decimal place 4, 5 or 6 or uninitialized */
static char base; /* 'd'ec or 'h'ex */
static char timestamps; /* 'a'bsolute or 'r'elative */
int data[8];
int i, found, opt;
- while ((opt = getopt(argc, argv, "I:O:v")) != -1) {
+ while ((opt = getopt(argc, argv, "I:O:v?")) != -1) {
switch (opt) {
case 'I':
infile = fopen(optarg, "r");
verbose = 1;
break;
+ case '?':
+ print_usage(basename(argv[0]));
+ return 0;
+ break;
+
default:
fprintf(stderr, "Unknown option %c\n", opt);
print_usage(basename(argv[0]));
dplace = strlen(tmp2);
if (verbose)
printf("decimal place %d, e.g. '%s'\n", dplace, tmp2);
- if ((dplace != 4) && (dplace != 6)) {
- printf("invalid dplace %d (must be 4 or 6)!\n", dplace);
+ if (dplace < 4 || dplace > 6) {
+ printf("invalid dplace %d (must be 4, 5 or 6)!\n", dplace);
return 1;
}
} else