Module:Sandbox/MonkeysHK/2

--- -- The Fundamental Theorems of Skydate -- -- I. The SkyBlock Second -- The SkyBlock conversion is based on the first principle of Skydate. The first principle provides that 1 Earth hour corresponds to 3 SkyBlock days. By extension, 1 SkyBlock minute is defined to be 5/6 (or ~0.83) seconds. -- The second is defined as being equal to the time duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the fundamental unperturbed ground-state of the caesium-133 atom [1]. In the Fundamental Theorems, the SkyBlock second is equal to the Earth second. -- It follows that 1 SkyBlock day corresponds to 24 SkyBlock hours, 1 SkyBlock hour corresponds to 60 SkyBlock minutes. This is equivallent to the time scale on Earth. By extension, the day, hour and minute units are 72 times shorter in SkyBlock than on Earth. -- -- II. The Daily Phenomina of SkyBlock -- The day and night cycle follows exactly the pattern of 12 SkyBlock hours + 12 SkyBlock hours, with no observable seasonal shifts. Historically, there have only been 1 SkyBlock mayor that attempted to manipulate the day and night cycle, and the effect of such event is not widely studied. -- There are exactly 31 SkyBlock days in a SkyBlock month, exactly 12 SkyBlock months in a SkyBlock year. In other words, there are 372 SkyBlock days (~5.17 Earth days), or 446,440 seconds in a SkyBlock year. -- It follows that if SkyBlock were to exist on our solar system, the orbital period of SkyBlock would be 372 SkyBlock days, or ~5.17 Earth days. The rotation period of SkyBlock would be 1 SkyBlock day, or 20 Earth minutes. -- -- III. Seasonal Calendar System -- SkyBlock uses a Tri-subseasonal Four-seasons calendar system. The SkyBlock Seasons equally divide a year into four equal periods ("Spring" "Summer" "Autumn" "Winter"). Each subseason further divides a Season into three equal periods ("Early" "Mid" "Late"). -- Within a year, Months 1-3 belong to Spring, Months 4-6 belong to Summer, Months 7-9 belong to Autumn, and Months 10-12 belong to Winter. Each SkyBlock Season lasts for exactly 93 SkyBlock days, or 31 Earth hours. -- Within a Season, the first 31 days belong to Early, the next 31 days belong to Mid, and the last 31 days belong to Late. Each SkyBlock Subseason lasts for 1 SkyBlock month, or ~10.33 Earth hours. -- -- IV. Time Measurement on SkyBlock -- The SkyBlock time is kept by a dialogue on the right that displays the 'time', in sync with servers on Hypixel, which is based in North America. However, this 'time' can subject to lag or slow ping, thus its accuracy depends on Internet speed and server health. -- It follows that time keeping on SkyBlock relies on the Earth time and infrastructure on Earth. -- The SkyBlock Epoch is defined as time of the Beginning of SkyBlock, at Earth time "Tue Jun 11 2019 17:55:00 UTC+0000 (Coordinated Universal Time)" and SkyBlock Time "00:00 AM, 1st of Early Spring, Year 1". -- -- References -- [1] - "Second". Wikipedia, 26 Oct. 2021, https://en.wikipedia.org/wiki/Second. Web. --- local makeClass = require("Module:Class")

local Skydate = makeClass("Skydate", {	constructor = function (self)		-- settings can be nothing, defaults to current time		-- settings can be a string or a table of values		-- settings can be a SkyBlock time or an Earth time		self:_parseSkyDate(settings)		self.earth = os.date('!*t', self.unix)		self:_unixConvert		return self	end,	static = {		skyblock_epoch = 1560275700,		seasons_long = {			'Early Spring', 'Spring', 'Late Spring',			'Early Summer', 'Summer', 'Late Summer',			'Early Autumn', 'Autumn', 'Late Autumn',			'Early Winter', 'Winter', 'Late Winter',		},		seasons_short = {			'ESP', 'SP', 'LSP',			'ESU', 'SU', 'LSU',			'EAU', 'AU', 'LAU',			'EWI', 'WI', 'LWI',		}	} })

Skydate.prototype._parseSkyDate = function (self, str) mw.log(settings) -- prepares self.unix if not settings then self.unix = os.time(os.date('!*t')) -- current time else self.unix = settings -- FOR TEST ONLY: set settings as unix end end

Skydate.prototype._unixConvert = function (self) -- Arithmetic Breakdown: -- 1 y = 12 mo = 372 d = 8928 h = 535680 m (in skyblock time) => 446400 s	-- 1 mo = 31 d = 744 h = 44640 m (in skyblock time) => 37200 s	-- 1 d = 24 h = 1440 m (in skyblock time) => 1200 s	-- 1 h = 60 m (in skyblock time) => 50 s	-- 1 m (in skyblock time) => 5/6 s	local remain = self.unix - Skydate.skyblock_epoch self.skyblock = {} skyblock = self.skyblock skyblock.year = math.floor(remain / 446400) remain = remain - skyblock.year * 446400 skyblock.month = math.floor(remain / 37200) remain = remain - skyblock.month * 37200 skyblock.day = math.floor(remain / 1200) remain = remain - skyblock.day * 1200 skyblock.hour = math.floor(remain / 50) remain = remain - skyblock.hour * 50 skyblock.min = math.floor(remain / (5/6)) remain = remain - skyblock.min * (5/6) skyblock.sec = remain skyblock.year = skyblock.year + 1 skyblock.month = skyblock.month + 1 skyblock.day = skyblock.day + 1 skyblock.h12 = (skyblock.hour % 12) == 0 and 12 or skyblock.hour % 12 skyblock.ampm = skyblock.hour < 12 and 'am' or 'pm' skyblock.season = Skydate.seasons_long[skyblock.month] skyblock.seasonS = Skydate.seasons_short[skyblock.month] end

-- return Skydate

local function test local inst = Skydate mw.logObject(inst) end

return { test = test }