###############################################################################
##
## Thommen B17 Clock by Bea Wolf (D-ECHO)
##
##  adapted from original Davtron 803 by dany93; Clément de l'Hamaide - PAF Team - http://equipe-flightgear.forumactif.com, heavily modified by Benedikt Hallinger
##  
##  This file is licensed under the GPL license version 2 or later.
##
###############################################################################

var clock	=	props.globals.getNode("instrumentation/clock", 1);
var elapsed_sec	=	clock.initNode("elapsed-sec",  0, "INT");

var knob_startstop = clock.initNode("knob-startstop", 0, "BOOL");
var knob_reset = clock.initNode("knob-reset", 0, "BOOL");

setlistener( "/sim/signals/fdm-initialized", func () {
	elapsed_sec.setIntValue( 0 );
});


var elapsed_timer = aircraft.timer.new("/instrumentation/clock/elapsed-sec", 1, 0);

# Buttons
var btn_startstop = func () {
	if( elapsed_timer.running ){
		elapsed_timer.stop();
	} else {
		elapsed_timer.start();
	}
}

var btn_reset = func () {
	interpolate( elapsed_sec, 0, 0.1 );
}
