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.)
Galactic Time and Scripting
Moderators: winston, another_commander
- PhantorGorth
- ---- E L I T E ----
- Posts: 647
- Joined: Wed May 20, 2009 6:48 pm
- Location: Somewhere off the top left of Galaxy 1 map
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
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:
This produces the following output in the log:
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", "-----------------------------------------------------");
}
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]: -----------------------------------------------------
- PhantorGorth
- ---- E L I T E ----
- Posts: 647
- Joined: Wed May 20, 2009 6:48 pm
- Location: Somewhere off the top left of Galaxy 1 map
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
And before anybody else asks: Look no further than
http://wiki.alioth.net/index.php/Oolite ... nce:_Clock
http://wiki.alioth.net/index.php/Oolite ... nce:_Clock