1import * as rtc from 'rtc' 2 3rtc.start(); 4 5var current_time = rtc.getTime(); 6console.log('rtc1: current time is ' + current_time); 7 8var my_date = new Date(); 9my_date.setFullYear(2008,7,9); 10 11console.log('rtc1: time.getYear() ' + my_date.getYear()); 12console.log('rtc1: time.getMonth() ' + my_date.getMonth()); 13console.log('rtc1: time.getDate() ' + my_date.getDate()); 14console.log('rtc1: time.getHours() ' + my_date.getHours()); 15console.log('rtc1: time.getMinutes() ' + my_date.getMinutes()); 16console.log('rtc1: time.getSeconds() ' + my_date.getSeconds()); 17 18rtc.setTime(my_date); 19 20console.log('Date is ' + my_date.toUTCString()); 21 22current_time = rtc.getTime(); 23console.log('rtc2: current time is ' + current_time); 24 25rtc.close(); 26