Introduction
Introduction Statistics Contact Development Disclaimer Help
tShow number of hours for exposures longer than 60 mins - filmtools - various t…
git clone git://src.adamsgaard.dk/filmtools
Log
Files
Refs
---
commit fdf4f540757312f4e76e5eddbd95f5c2cb9e2691
parent e818b1a505a41603d281dfdaabd683053e824607
Author: Anders Damsgaard <[email protected]>
Date: Thu, 16 Jul 2020 22:36:50 +0200
Show number of hours for exposures longer than 60 mins
Diffstat:
M reciprocity.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/reciprocity.c b/reciprocity.c
t@@ -47,7 +47,7 @@ int
main(int argc, char **argv)
{
double exponent;
- int i, min, sec, sec_equiv;
+ int i, hour, min, sec, sec_equiv;
argv0 = *argv;
t@@ -73,11 +73,15 @@ main(int argc, char **argv)
if (sscanf(argv[2], "%d:%d", &min, &sec) != 2)
errx(2, "could not parse time in MM:SS format");
- sec_equiv = pow(min*60 + sec, exponent);
-
- printf("%d:%02d\n",
- (int)(sec_equiv/60.0),
- (int)(sec_equiv)%60);
+ sec_equiv = pow(min * 60 + sec, exponent);
+ sec = (int)(sec_equiv) % 60;
+ if ((min = (int)(sec_equiv / 60.0)) >= 60) {
+ hour = (int)(min/60.0);
+ min -= (int)(hour*60.0);
+ printf("%d:%02d:%02d\n", hour, min, sec);
+ } else {
+ printf("%d:%02d\n", min, sec);
+ }
return 0;
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.