Page 1 of 1
Galactic Time and Scripting
Posted: Thu Dec 31, 2009 5:01 pm
by PhantorGorth
Is there a way to get the current Galactic Mean Time via Javascript?
I have searched both the wiki and the board and can not find anything on this. (This maybe because the appropriate search terms are bringing up too many false hits for me to wade through though.)
Posted: Thu Dec 31, 2009 5:11 pm
by another_commander
Yes, there is a set of JS functions and properties to access the clock both as full string format and as its individual elements. Here is an example of how to use it:
Code: Select all
this.clockReport = function()
{
log("clockReport.begin","---------------------------------------------------");
log("clockReport.absoluteSeconds", clock.absoluteSeconds);
log("clockReport.seconds", clock.seconds);
log("clockReport.minutes", clock.minutes);
log("clockReport.hours", clock.hours);
log("clockReport.days", clock.days);
log("clockReport.secondsComponent", clock.secondsComponent);
log("clockReport.minutesComponent", clock.minutesComponent);
log("clockReport.hoursComponent", clock.hoursComponent);
log("clockReport.daysComponent", clock.daysComponent);
log("clockReport.clockString", clock.clockString);
log("clockReport.isAdjusting", clock.isAdjusting);
log("clockReport.end", "-----------------------------------------------------");
}
This produces the following output in the log:
Latest.log wrote:
[clockReport.begin]: ---------------------------------------------------
[clockReport.absoluteSeconds]: 5.822000026702881
[clockReport.seconds]: 180058011442.82214
[clockReport.minutes]: 3000966857
[clockReport.hours]: 50016114
[clockReport.days]: 2084004
[clockReport.secondsComponent]: 22
[clockReport.minutesComponent]: 17
[clockReport.hoursComponent]: 18
[clockReport.daysComponent]: 2084004
[clockReport.clockString]: 2084004:18:17:22
[clockReport.isAdjusting]: false
[clockReport.end]: -----------------------------------------------------
Posted: Thu Dec 31, 2009 5:16 pm
by PhantorGorth
Thanks, precisely what I need.
Now I know what it is called I can see it is in the wiki.
Regards,
PhantorGorth
Posted: Sun Jan 03, 2010 8:48 am
by Commander McLane