| | 13 | |
| | 14 | 5. Have the program automatically increment the time by 30 seconds for each line of output. The following code should do the trick. It just needs to be inserted into the appropriate spot in vdsLayer. (0.5) |
| | 15 | {{{ |
| | 16 | // Initialize the current time to zero |
| | 17 | var currentTime = new Date(0); |
| | 18 | currentTime.setHours(0); |
| | 19 | currentTime.setMinutes(0); |
| | 20 | currentTime.setSeconds(0); |
| | 21 | |
| | 22 | // Increment the time by one-half minute (30 seconds) |
| | 23 | var millisecs = currentTime.getTime(); |
| | 24 | millisecs += 30000; |
| | 25 | var currentTime = new Date(millisecs) |
| | 26 | |
| | 27 | // Create a printable string for the time (HH:MM:SS) |
| | 28 | var printableTime = currentTime.toLocaleTimeString('it-IT') |
| | 29 | }}} |