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. ---

require('Module:LoadLib')(_G)

-- Set exports local skydate = {} local seasonsL = { 'Early Spring', 'Spring', 'Late Spring', 'Early Summer', 'Summer', 'Late Summer', 'Early Autumn', 'Autumn', 'Late Autumn', 'Early Winter', 'Winter', 'Late Winter', } local seasonsS = { 'ESP', 'SP', 'LSP', 'ESU', 'SU', 'LSU', 'EAU', 'AU', 'LAU', 'EWI', 'WI', 'LWI', }

function skydate:create(settings) local methods = {} local skyblock_epoch = 1560275700 function methods:constructor(settings) if not settings then self.unix = os.time(os.date("!*t")) -- current time else -- settings can be a string or a table of values -- settings can be a SkyBlock time or an Earth time self:_parseSkyDate(settings) end self:_unixConvert return self end function methods:_parseSkyDate(str) -- prepares self.unix end function methods:_unixConvert -- 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 - 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.minute = math.floor(remain / (5/6)) remain = remain - skyblock.minute * (5/6) skyblock.second = remain skyblock.year = skyblock.year + 1 skyblock.month = skyblock.month + 1 skyblock.day = skyblock.day + 1 skyblock.hour12 = (skyblock.hour % 12) == 0 and 12 or skyblock.hour % 12 skyblock.ampm = skyblock.hour < 12 and 'am' or 'pm' skyblock.season_long = seasonsL[skyblock.month] skyblock.season_short = seasonsS[skyblock.month] self.sbyear = skyblock.year self.sbmonth = skyblock.month self.sbday = skyblock.day self.sbhour = skyblock.hour self.sbminute = skyblock.minute self.sbsecond = skyblock.second self.sbhour12 = skyblock.hour12 self.sbampm = skyblock.ampm self.season_long = skyblock.season_long self.season_short = skyblock.season_short end -- Create and invoke class local Class = table.makeClass(methods) return Class(settings) end

return skydate