SLClock.sleela
lib/operating-system/SLClock.sleela · 76 line(s) · sleela
<< lib/operating-system/SLClock.sleela
SLeeLa Standard Library Definition.
Definition: Defines SLClock — the host system clock, as seen from the OS
family. It surfaces wall-clock and monotonic time through the VM's time
built-ins (timeUtcMillis / timeMonotonicNanos / timeHttpDate), which read
the real OS clock (QueryPerformanceCounter + system time on Windows,
clock_gettime on POSIX). SLClock belongs to /lib/os because time is an
operating-system service; it reuses the time substrate rather than
duplicating it.
Family: operating-system. Native VM/OS work crosses the explicit time/`os*` SLVM bridge. >>
#sleela 2.5
material;
class SLClock {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 219;
String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
String metaDate = "2026-10-16";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-09-28";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
< monotonic reference captured at reset (nanoseconds) >
int monoStart;
void configure() { monoStart = 0; }
< Milliseconds since the Unix epoch (UTC wall-clock). >
int nowMillis() { return timeUtcMillis(); }
< Monotonic nanoseconds (never goes backward; for durations). >
int monotonicNanos() { return timeMonotonicNanos(); }
< An RFC 1123 HTTP date string for "now". >
String httpDate() { return timeHttpDate(); }
< The host's configured time-zone location. >
String location() { return timeLocation(); }
< Start a monotonic stopwatch. >
void reset() { monoStart = timeMonotonicNanos(); }
< Elapsed nanoseconds since reset(). >
int elapsedNanos() { return timeMonotonicNanos() - monoStart; }
< Elapsed whole milliseconds since reset(). >
int elapsedMillis() { return (timeMonotonicNanos() - monoStart) / 1000000; }
}