// ====================================================================================== function getSchedule() { // List of all available measurement types var measurementType = [ "STARTUP", "IDLE", "DRSCALIB", "SINGLEPE", "DATA", "RATESCAN", "SHUTDOWN" ]; // Get current time var start = new Date();//new Date("2013-04-07 19:00:00 UTC"); // Because Main.js could start a new observations just in the moment between 'now' // and entering the new data in the database, we have to use the unique id // in Main.js to check if the current observation should be changed (and sub resetted) start = new Date(start.getTime()-12*3600000); // ---------------------------------------------------------------------- // Connect to database var db = new Database($['schedule-database']); // get all sources from database var sources = db.query("SELECT * from Source"); // Get the current schedule var rows = db.query("SELECT * FROM Schedule WHERE fStart>'"+start.toISOString()+"' ORDER BY fStart, fMeasurementID"); // Close db connection db.close(); // ---------------------------------------------------------------------- var schedule = []; var entry = -1; var sub = 0; for (var i=0; i