Welcome, Guest. Please Login or Register
Home Help Search Login Register
Page Index Toggle Pages: 1
Send Topic Print
How to display milliseconds in days HH:mm:ss.ms? (Read 7908 times)
Yogie
Ex Member


How to display milliseconds in days HH:mm:ss.ms?
04/10/12 at 14:58:24
 
Hi,

I found some code where in OCC milliseconds would be displayed in minutes and seconds... I would like to know if you can help me out with it on how to display milliseconds in days HH:mm:ss.ms?

ExposureTime is a value of x milliseconds...

This is what I found and slightly changed:


            Code (C++):
TimeEstimate = ExposureTime;
            TimeEstimateDays= ________________;
            TimeEstimateHours= ________________;
            TimeEstimateMinutes=(TimeEstimate/1000)/60;
            TimeEstimateSeconds=(TimeEstimate/1000)-(TimeEstimateMinutes*60);
            TimeEstimateMilliseconds= ________________;

            // days
            ________________;
            // hours
            ________________;
            // minutes
            dummy=TimeEstimateMinutes-(int(TimeEstimateMinutes/10)*10);
            PA_OutputText (1,18,5,"%d:",dummy);
            dummy=int((TimeEstimateMinutes-dummy)/10);
            PA_OutputText (1,17,5,"%d",dummy);
            // seconds
            dummy=TimeEstimateSeconds-(int(TimeEstimateSeconds/10)*10);
            PA_OutputText (1,21,5,"%d",dummy);
            dummy=int((TimeEstimateSeconds-dummy)/10);
            PA_OutputText (1,20,5,"%d",dummy);
            // milliseconds
            ________________; 



Any idea? Roll Eyes

Thanks in advance
Back to top
 
 
IP Logged
 
Steve Chapman
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #1 - 04/12/12 at 23:29:39
 
I think you are looking at the code that estimates the overall timelength of the entire bracketing sequence. I'm not certain that this is what you want to show in ms?
Back to top
 
 
IP Logged
 
Yogie
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #2 - 04/13/12 at 20:43:07
 
Hi Steve,

maybe it is a bit off topic for OCC but I'm trying to program a ND calculator which would be able to control also (for a specific range of time) your camera in bulb mode. So the milliseconds that I wish to get into format would be really

days HH:mm:ss.ms (just to let the photographer know where she/he lands up when using the time and nd filter combination)

and the amount of time that I calculate is in milliseconds just like in OCC.

So I would need to know the formulas to calculate the days, hours etc. and the formulas to display the time in a human readable format like above.

Back to top
 
 
IP Logged
 
Steve Chapman
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #3 - 04/26/12 at 16:07:15
 
Thanks to Capt. Kirk and Tonto, free time is scarce around here lately, though I have not forgotten.
Back to top
 
 
IP Logged
 
Yogie
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #4 - 04/28/12 at 17:48:45
 
Here is the solution...

                       Code (C++):
TimeEstimate = TimeEstimate / 1000;
TimeEstimateDays = int(TimeEstimate / 86400);
TimeEstimateHours = int((TimeEstimate - (TimeEstimateDays * 86400)) / 3600);
TimeEstimateMinutes = int((TimeEstimate - (TimeEstimateDays * 86400) - (TimeEstimateHours * 3600)) / 60);
TimeEstimateSeconds = int((TimeEstimate - (TimeEstimateDays * 86400) - (TimeEstimateHours * 3600) - (TimeEstimateMinutes * 60)));
TimeEstimateMilliseconds = int((TimeEstimate - (TimeEstimateDays * 86400) - (TimeEstimateHours * 3600) - (TimeEstimateMinutes * 60) - TimeEstimateSeconds) * 1000); 

Back to top
 
 
IP Logged
 
Steve Chapman
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #5 - 04/30/12 at 19:08:43
 
Cool news. To summarize what I believe Joerg is doing, the camera's built in meter will not properly expose for anything longer than 30 seconds (in Canon's case) so by metering for a shot without the ND, then running that through the ND calculator, the correct bulb-mode exposure time can be computed for the shot with the ND filter in place.
Back to top
 
 
IP Logged
 
Yogie
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #6 - 04/30/12 at 21:41:15
 
Hi Steve,

yes correct. And I'm pretty far with my solution now.

I also added the functionality of a "normal" remote switch, having a key for the shutter button and also a shutter-release lock.

Now I just need to know which is the shortest time I can trigger in bulb mode and what is the longest time I can trigger in bulb mode? To show if the ND time could be timed with the app or not.

Are there differences with the brands and models of the DSLRs?

I can just test it with my Canon 7D...
Back to top
 
 
IP Logged
 
Yogie
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #7 - 05/02/12 at 20:20:45
 
Hi,

my first draft is now ready and it does pretty much what it should Smiley

But I encounter one thing I can not solve or get rid of. When my program is running after a while it seems to crash as my NDS switches off. So something seems to be going wrong. I just created a kind of "Hello World" program and this is just doing fine and is not switching off the NDS.So I added the following lines to my program:

Code:
debugnbr = debugnbr + 1;
PA_OutputText (0,1,20,"Debug %d",debugnbr); 



and without doing anything like pressing any button etc. the program hangs exactly at the same "debugnbr" so the program crashes anytime at the same position.

Any idea how to troubleshot or to look after to find out why the program crashes anytime at the exact same time/position?

Many thanks!
Back to top
 
 
IP Logged
 
Yogie
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #8 - 05/04/12 at 11:28:10
 
Ok, I have found why the program was terminating after a while. It seems that writing text on the screen will fill up the DS's memory until it's limit. So I redesigned my code and used more sprites instead of text. Anyhow I would like to know why writing text (again and again to the same position) causes this crash.

Is there any command to prevent filling up the memory and clear or reset the memory before writing new stuff, so that overfilling and a crash due to this could be prevented?

BTW. did someone already tried to save variables into a file or the .sav file to store the latest settings and reload these with the next start of the program?
Back to top
 
 
IP Logged
 
Blochi
Administrator
*****
Offline



Posts: 1726
Hollywood
Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #9 - 05/04/12 at 12:17:08
 
Quote:
BTW. did someone already tried to save variables into a file or the .sav file to store the latest settings and reload these with the next start of the program?


Now we're talking! That's a brilliant idea.

A good save-point would be right after shooting a sequence, when the images are saved anyways. This could also be helpful as a logfile. You could make this human-readable (maybe with clear annotations) and put in a counter setting that would allow to synchronize the log filename with the image file name number. I'm sure it would be a breeze to whip together a batch processor for Picturenaut, that just works off the log files...

So, two save files please, after each bracketing sequence:
default.occ
DSC_3440-3450.occ



Back to top
 
WWW  
IP Logged
 
Steve Chapman
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #10 - 05/06/12 at 03:15:14
 
It's trivial to add saves, though I didn't place it in the public release because the driver for each brand of memory card was different.
Back to top
 
 
IP Logged
 
Yogie
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #11 - 05/10/12 at 11:18:51
 
Uhm, when I launch a program the NDS is always creating a <program-name>.SAV file can we handle that or do we need to create our own file where to store settings?
Back to top
 
 
IP Logged
 
Steve Chapman
Ex Member


Re: How to display milliseconds in days HH:mm:ss.ms?
Reply #12 - 06/06/12 at 19:10:20
 
You might look into the EFS library which provides io functions that will allow you to save settings. The issue is the required DLDI patching that will only allow the saves to work on your specific type of flash cart. Since the original OCC was written for a TT card and most people use an R4, it would have been messy to introduce setting saves.
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print