From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../en_CCNA4_v30/elabs/Engine/actions_timer.txt | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/actions_timer.txt (limited to 'Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/actions_timer.txt') diff --git a/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/actions_timer.txt b/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/actions_timer.txt new file mode 100644 index 0000000..909b3b7 --- /dev/null +++ b/Bachelor/CCNA4/en_CCNA4_v30/elabs/Engine/actions_timer.txt @@ -0,0 +1,30 @@ +// Timing Functions + +StartTime = null; // this variable is set when the start button is pressed + // so that the user is not penalized for the loading time of flash + +// timer_timeCompute() +// IN : none +// DO : calculates the minutes and seconds elapsed since the user began the simulation +// OUT: print it out into a text field + +function timer_timeCompute() +{ + var CurrentTime = (getTimer()-StartTime)/1000; // gets the current time in milliseconds, subtracts the starttime, + // and converts it into seconds. + + var Minute = Math.floor(CurrentTime/60); // get # of minutes in current time + var Second = Math.floor(((CurrentTime/60) - Minute) * 60); // get # of seconds in current time + + if ((Minute.toString()).length == 1) { + // adding a zero to # of minutes if it is less than 10 for correct display + Minute = "0" + Minute; + } + + if ((Second.toString()).length == 1) { + // adding a zero to # of seconds if it is less than 10 for correct display + Second = "0" + Second; + } + + _root.Menu.Clock.TIME = Minute + ":" + Second; // display time elapsed +} \ No newline at end of file -- cgit v1.2.3