- tools: some manual code nicenings

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2021-11-07 00:57:01 +01:00
committed by Thilo Graf
parent 4e78667ace
commit 0e054cc785
2 changed files with 9 additions and 8 deletions

View File

@@ -69,7 +69,7 @@ int main(int argc, char **argv)
printf("converting %s -> %s\n", fname, destname); printf("converting %s -> %s\n", fname, destname);
/* it does not exist or has a different date, so call ffmpeg... */ /* it does not exist or has a different date, so call ffmpeg... */
sprintf(cmd, "ffmpeg -y -f mjpeg -i '%s' -s %s '%s' </dev/null", sprintf(cmd, "ffmpeg -y -f mjpeg -i '%s' -s %s '%s' </dev/null",
fname, TARGETRES, destname); fname, TARGETRES, destname);
system(cmd); /* TODO: use libavcodec to directly convert it */ system(cmd); /* TODO: use libavcodec to directly convert it */
utime(destname, &u); utime(destname, &u);
} }

View File

@@ -64,14 +64,14 @@ double mod_julian_date(struct tm *t)
int day; int day;
int year; int year;
year = t->tm_year + 1900; year = t->tm_year + 1900;
month = t->tm_mon + 1; month = t->tm_mon + 1;
day = t->tm_mday; day = t->tm_mday;
date = day - 32076 + date = day - 32076 +
1461 * (year + 4800 + (month - 14) / 12) / 4 + 1461 * (year + 4800 + (month - 14) / 12) / 4 +
367 * (month - 2 - (month - 14) / 12 * 12) / 12 - 367 * (month - 2 - (month - 14) / 12 * 12) / 12 -
3 * ((year + 4900 + (month - 14) / 12) / 100) / 4; 3 * ((year + 4900 + (month - 14) / 12) / 100) / 4;
date += (t->tm_hour + 12.0) / 24.0; date += (t->tm_hour + 12.0) / 24.0;
date += (t->tm_min) / 1440.0; date += (t->tm_min) / 1440.0;
@@ -212,10 +212,10 @@ int main(int argc, char **argv)
} }
tmp = gmtime(&t2); tmp = gmtime(&t2);
fprintf(stderr, "current time: %04d-%02d-%02d %02d:%02d:%02d\n", tmp->tm_year + 1900, fprintf(stderr, "current time: %04d-%02d-%02d %02d:%02d:%02d\n", tmp->tm_year + 1900,
tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
tmp = gmtime(&t); tmp = gmtime(&t);
fprintf(stderr, "wakeup time: %04d-%02d-%02d %02d:%02d:%02d\n", tmp->tm_year + 1900, fprintf(stderr, "wakeup time: %04d-%02d-%02d %02d:%02d:%02d\n", tmp->tm_year + 1900,
tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
ret = ioctl(fd, VFDSETPOWERONTIME, &t); ret = ioctl(fd, VFDSETPOWERONTIME, &t);
break; break;
case 'P': case 'P':
@@ -254,6 +254,7 @@ int main(int argc, char **argv)
ret = val; ret = val;
} }
break; break;
// Reminder to myself, here's a semi-sane default for Pingulux boxes: // Reminder to myself, here's a semi-sane default for Pingulux boxes:
// spark_fp -S 0:9966da25 -S 1:11eeda25 -S 2:cc33ba45 -S 3:dd227887 -S 4:aa557887 -B 0:996640bf -B 1:11ee40bf -B 2:cc33b847 -B 3:dd2228d7 -B 4:aa5528d7 // spark_fp -S 0:9966da25 -S 1:11eeda25 -S 2:cc33ba45 -S 3:dd227887 -S 4:aa557887 -B 0:996640bf -B 1:11ee40bf -B 2:cc33b847 -B 3:dd2228d7 -B 4:aa5528d7
// Not sure whether these are the original settings. --martii // Not sure whether these are the original settings. --martii