<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MCT Stamp and Planner with Conversion</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 0;
padding: 0;
}
.form-container {
margin-top: 20px;
}
#time,
#date,
#counterTrack,
.mct-result-item {
display: block;
font-size: 1.5rem;
margin: 0;
line-height: 1.2;
}
h1,
h2,
h3 {
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
}
input,
select,
button {
font-size: 1rem;
margin: 5px;
padding: 8px 12px;
}
#result,
#local-result {
margin-top: 20px;
font-size: 1.5rem;
}
.warning-banner {
background-color: #ffcccc;
color: #900;
padding: 10px;
margin: 0;
display: none; /* hidden by default */
}
hr {
border: none;
border-top: 1px solid #ddd;
margin: 20px 0;
}
</style> <!-- A hidden banner to show if all APIs fail -->
<div id="warning-banner" class="warning-banner">
Warning: Could not fetch accurate server time. Using local device time, which may be inaccurate.
</div>
<h1>Current MCT Stamp</h1> <span id="time">Loading...</span> <span id="date">Loading...</span> <span id="counterTrack">Loading...</span>
<h2>MCT Planner</h2>
<h2>Local-to-MCT Conversion</h2>
<div class="form-container"> <label for="datetime">Enter Local Date & Time:</label>
<br>
<input type="datetime-local" id="datetime" placeholder="YYYY-MM-DDTHH:mm">
<br> <label for="timezone">Select Local Timezone:</label>
<br> <select id="timezone"> <!-- Original 5 options --> <option value="America/Chicago">Chicago (CST/CDT)</option> <option value="UTC">UTC</option> <option value="America/New_York">New York (EST/EDT)</option> <option value="Asia/Hong_Kong">Hong Kong</option> <option value="Europe/London">UK (Europe/London)</option> <!-- 30 additional timezones --> <option value="Africa/Cairo">Cairo (EET)</option> <option value="Africa/Johannesburg">Johannesburg (SAST)</option> <option value="Africa/Lagos">Lagos (WAT)</option> <option value="America/Bogota">Bogotá (COT)</option> <option value="America/Denver">Denver (MST/MDT)</option> <option value="America/Indianapolis">Indianapolis (EST)</option> <option value="America/Los_Angeles">Los Angeles (PST/PDT)</option> <option value="America/Mexico_City">Mexico City</option> <option value="America/Phoenix">Phoenix (MST)</option> <option value="America/Sao_Paulo">São Paulo (BRT)</option> <option value="America/Toronto">Toronto (EST/EDT)</option> <option value="Atlantic/Azores">Azores</option> <option value="Australia/Perth">Perth (AWST)</option> <option value="Australia/Sydney">Sydney (AEST/AEDT)</option> <option value="Asia/Bangkok">Bangkok (ICT)</option> <option value="Asia/Dubai">Dubai (GST)</option> <option value="Asia/Jerusalem">Jerusalem (IST)</option> <option value="Asia/Kolkata">Kolkata (IST)</option> <option value="Asia/Seoul">Seoul (KST)</option> <option value="Asia/Shanghai">Shanghai (CST)</option> <option value="Asia/Singapore">Singapore (SGT)</option> <option value="Asia/Tokyo">Tokyo (JST)</option> <option value="Atlantic/Reykjavik">Reykjavik (GMT)</option> <option value="Europe/Berlin">Berlin (CET/CEST)</option> <option value="Europe/Madrid">Madrid (CET/CEST)</option> <option value="Europe/Moscow">Moscow (MSK)</option> <option value="Europe/Paris">Paris (CET/CEST)</option> <option value="Europe/Rome">Rome (CET/CEST)</option> <option value="Europe/Warsaw">Warsaw (CET/CEST)</option> <option value="Pacific/Auckland">Auckland (NZST/NZDT)</option> <option value="Pacific/Honolulu">Honolulu (HST)</option> </select>
<br> <button onclick="convertToMCT()">Convert to MCT</button>
</div>
<div id="result"></div>
<h2 style="font-weight: bold;">MCT-to-Local Conversion</h2>
<div class="form-container"> <label for="mct-time">MCT Time (optional):</label>
<br>
<input type="time" id="mct-time">
<br> <label for="mct-date">MCT Date (optional):</label>
<br>
<input type="date" id="mct-date">
<br> <label for="mct-counter">MCT Counter (optional):</label>
<br>
<input type="number" id="mct-counter" placeholder="Seconds since MCT epoch">
<br> <label for="local-timezone">Select Local Timezone:</label>
<br> <select id="local-timezone"> <!-- Original 5 options --> <option value="America/Chicago">Chicago (CST/CDT)</option> <option value="UTC">UTC</option> <option value="America/New_York">New York (EST/EDT)</option> <option value="Asia/Hong_Kong">Hong Kong</option> <option value="Europe/London">UK (Europe/London)</option> <!-- 30 additional timezones --> <option value="Africa/Cairo">Cairo (EET)</option> <option value="Africa/Johannesburg">Johannesburg (SAST)</option> <option value="Africa/Lagos">Lagos (WAT)</option> <option value="America/Bogota">Bogotá (COT)</option> <option value="America/Denver">Denver (MST/MDT)</option> <option value="America/Indianapolis">Indianapolis (EST)</option> <option value="America/Los_Angeles">Los Angeles (PST/PDT)</option> <option value="America/Mexico_City">Mexico City</option> <option value="America/Phoenix">Phoenix (MST)</option> <option value="America/Sao_Paulo">São Paulo (BRT)</option> <option value="America/Toronto">Toronto (EST/EDT)</option> <option value="Atlantic/Azores">Azores</option> <option value="Australia/Perth">Perth (AWST)</option> <option value="Australia/Sydney">Sydney (AEST/AEDT)</option> <option value="Asia/Bangkok">Bangkok (ICT)</option> <option value="Asia/Dubai">Dubai (GST)</option> <option value="Asia/Jerusalem">Jerusalem (IST)</option> <option value="Asia/Kolkata">Kolkata (IST)</option> <option value="Asia/Seoul">Seoul (KST)</option> <option value="Asia/Shanghai">Shanghai (CST)</option> <option value="Asia/Singapore">Singapore (SGT)</option> <option value="Asia/Tokyo">Tokyo (JST)</option> <option value="Atlantic/Reykjavik">Reykjavik (GMT)</option> <option value="Europe/Berlin">Berlin (CET/CEST)</option> <option value="Europe/Madrid">Madrid (CET/CEST)</option> <option value="Europe/Moscow">Moscow (MSK)</option> <option value="Europe/Paris">Paris (CET/CEST)</option> <option value="Europe/Rome">Rome (CET/CEST)</option> <option value="Europe/Warsaw">Warsaw (CET/CEST)</option> <option value="Pacific/Auckland">Auckland (NZST/NZDT)</option> <option value="Pacific/Honolulu">Honolulu (HST)</option> </select>
<br> <button onclick="convertToLocal()">Convert to Local</button>
</div>
<div id="local-result"></div> <!-- Include Luxon from CDN -->
<script src="https://cdn.jsdelivr.net/npm/luxon@3/build/global/luxon.min.js"></script>
<script>
/*
This code uses multiple fallback APIs to fetch a reliable UTC time on page load.
If all APIs fail, it alerts (banner) the user and reverts to local device time.
The MCT stamp (UTC-6) is then updated every second using the server-based offset.
*/
const ACTUAL_BASELINE = Date.UTC(1992, 5, 1, 0, 0, 0); // MCT Epoch
let serverOffset = 0; // We'll compute this once we fetch a server time
// Our fallback APIs
const timeAPIs = [
async () => {
const res = await fetch("https://worldtimeapi.org/api/timezone/Etc/UTC");
if (!res.ok) throw new Error("API 1 responded with " + res.status);
const data = await res.json();
return new Date(data.utc_datetime).getTime();
},
async () => {
const res = await fetch("https://timeapi.io/api/Time/current/zone?timeZone=UTC");
if (!res.ok) throw new Error("API 2 responded with " + res.status);
const data = await res.json();
return new Date(data.dateTime + "Z").getTime();
},
async () => {
const res = await fetch("https://worldtimeapi.org/api/ip");
if (!res.ok) throw new Error("API 3 responded with " + res.status);
const data = await res.json();
return new Date(data.utc_datetime).getTime();
}
];
async function fetchAccurateUTC() {
for (const apiCall of timeAPIs) {
try {
const serverUTC = await apiCall();
const localNow = Date.now();
serverOffset = serverUTC - localNow;
console.log("[MCT] Successfully fetched server time. Offset =", serverOffset);
return;
} catch (err) {
console.warn("[MCT] Fallback API failed:", err);
}
}
// If we get here, all APIs failed
console.error("[MCT] All time APIs failed. Falling back to device time!");
// Show a warning banner
document.getElementById("warning-banner").style.display = "block";
// offset = 0 means we rely on device time
serverOffset = 0;
}
function getAccurateTime() {
return Date.now() + serverOffset;
}
function updateMCTStamp() {
const currentTime = getAccurateTime();
const elapsedSinceBaseline = Math.floor((currentTime - ACTUAL_BASELINE) / 1000);
// MCT = UTC-6
const mctTime = new Date(currentTime - 6 * 3600 * 1000);
const formattedTime = mctTime.toISOString().substr(11, 8);
const formattedDate = mctTime.toISOString().substr(0, 10);
document.getElementById("time").innerText = formattedTime;
document.getElementById("date").innerText = formattedDate;
document.getElementById("counterTrack").innerText = elapsedSinceBaseline;
}
function formatMCTResult(mctTime, mctDate, counter) {
return `
<h2>MCT Stamp</h2>
<span class="mct-result-item">${mctTime}</span>
<span class="mct-result-item">${mctDate}</span>
<span class="mct-result-item">${counter}</span>
`;
}
function formatLocalResult(localTime, localDate) {
return `
<h2>Local Time</h2>
<span class="mct-result-item">${localTime}</span>
<span class="mct-result-item">${localDate}</span>
`;
}
// Local -> MCT
async function convertToMCT() {
const datetimeInput = document.getElementById("datetime").value;
const timezone = document.getElementById("timezone").value;
if (!datetimeInput) {
displayResult("Please select a date and time.");
return;
}
const { DateTime } = luxon;
const userDateTime = DateTime.fromISO(datetimeInput, { zone: timezone });
const utcDateTime = userDateTime.toUTC();
const mctDateTime = utcDateTime.minus({ hours: 6 });
// For the epoch counter, we use the "real" UTC timestamp from user input (Luxon).
const elapsedSinceBaseline = Math.floor((utcDateTime.toMillis() - ACTUAL_BASELINE) / 1000);
const mctTime = mctDateTime.toFormat("HH:mm:ss");
const mctDate = mctDateTime.toFormat("yyyy-MM-dd");
displayResult(formatMCTResult(mctTime, mctDate, elapsedSinceBaseline));
}
function displayResult(content) {
document.getElementById("result").innerHTML = content;
}
// MCT -> Local
async function convertToLocal() {
const mctTimeInput = document.getElementById("mct-time").value;
const mctDateInput = document.getElementById("mct-date").value;
const mctCounterInput = document.getElementById("mct-counter").value;
const localTimezone = document.getElementById("local-timezone").value;
const { DateTime } = luxon;
if (!mctCounterInput && (!mctTimeInput || !mctDateInput)) {
displayLocalResult("Please provide either an MCT counter or both MCT time and date.");
return;
}
let mctDateTime;
if (mctCounterInput) {
// The MCT counter is real UTC seconds since 1992-06-01 00:00 UTC.
const mctMilliseconds = ACTUAL_BASELINE + parseInt(mctCounterInput, 10) * 1000;
// Instead of subtracting 6 hours, we just interpret that same absolute moment as "UTC",
// then *show* it in MCT by setting the zone to 'Etc/GMT+6'.
const realUTC = DateTime.fromMillis(mctMilliseconds, { zone: "utc" });
mctDateTime = realUTC.setZone("Etc/GMT+6");
} else {
// MCT date/time => parse as "UTC-6" using 'Etc/GMT+6'
const combined = `${mctDateInput}T${mctTimeInput}`;
mctDateTime = DateTime.fromISO(combined, { zone: "Etc/GMT+6" });
}
// Now convert that MCT moment to the chosen local time zone
const localDateTime = mctDateTime.setZone(localTimezone);
displayLocalResult(
formatLocalResult(
localDateTime.toFormat("hh:mm:ss a"),
localDateTime.toFormat("yyyy-MM-dd")
)
);
}
function displayLocalResult(content) {
document.getElementById("local-result").innerHTML = content;
}
// On load, fetch server UTC, set offset, then start 1s interval
window.addEventListener("load", async () => {
await fetchAccurateUTC(); // fetch time from fallback APIs
updateMCTStamp(); // immediate update
setInterval(updateMCTStamp, 1000); // then update MCT stamp every second
});
</script> <!--
README.md
# Metaverse Cyber Time (MCT)
A **digital-first, epoch-based** time standard that combines:
1. A **24-hour clock** fixed to UTC-6 (no DST).
2. An **ISO 8601** date string (`YYYY-MM-DD`) in UTC-6.
3. A **continuous epoch counter** representing seconds since **June 1, 1992, 00:00 UTC** (ignoring leap seconds).
This repository demonstrates a **browser-based** implementation of MCT, allowing:
- **Real-time MCT stamping** (continuous updating of time/date/counter).
- **Local → MCT conversions** for planning and scheduling.
- **MCT → Local conversions** using either the MCT epoch counter or MCT date/time.
- **Fallback-based server time fetching** (from 3 public APIs) to reduce reliance on a user’s device clock.
---
## Disclaimer
This software is provided **as is**, without warranty of any kind—express or implied—including but not limited to warranties of merchantability, fitness for a particular purpose, or non-infringement. In no event shall the authors or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages arising out of or in connection with the use or inability to use this software.
Any statements regarding potential utility in AI, blockchain, or distributed systems are observations about possible use cases, **not** guarantees of fitness. Users must evaluate its suitability for their specific applications and assume all risks associated with implementation.
---
## Table of Contents
- [Files](#files)
- [Live Demo](#live-demo)
- [Key Features](#key-features)
- [Project Setup & Usage](#project-setup--usage)
- [How It Works](#how-it-works)
- [Known Limitations](#known-limitations)
- [Why MCT?](#why-mct)
- [License](#license)
## Files
- **index.html**
- Complete MCT code:
- HTML/CSS interface.
- JavaScript (Luxon) for timezone handling.
- Multiple fallback APIs to fetch a reliable UTC time.
- If all fail, displays a warning banner and reverts to device time.
- `convertToMCT()` for local-to-MCT.
- `convertToLocal()` for MCT-to-local.
- `updateMCTStamp()` updates the MCT display once per second.
- **README.md**
- The document you’re reading now.
- Includes usage instructions, disclaimers, and a summary of MCT.
---
## Live Demo
If you host `index.html` on a server (e.g., [https://metaversecybertime.com](https://metaversecybertime.com)), you’ll see:
- A continuously updating **MCT Stamp**: `HH:MM:SS`, `YYYY-MM-DD`, and an epoch counter.
- Conversions to and from MCT.
## Key Features
1. **Server-Based MCT**
- Fetches accurate UTC from 3 external APIs in sequence, reducing reliance on local device settings.
- Falls back to user’s device time only if all 3 calls fail.
2. **UTC-6**
- MCT is consistently 6 hours behind UTC, never adjusting for DST.
3. **Leap-Second-Free Counter**
- The epoch starts at **June 1, 1992 (00:00 UTC)** and increments continuously, ignoring leap seconds.
4. **Local ↔ MCT Conversions**
- Use Luxon to parse timezones for user input or MCT stamps.
---
## Project Setup & Usage
1. **Download / Clone** the repository.
2. **Open `index.html`** in a modern browser (Chrome, Firefox, Safari, Edge).
3. **Ensure Network Access** (to fetch Luxon + time APIs).
### Steps
- **Observe MCT Stamp**: top of the page, updates every second.
- **Local→MCT**:
1. Enter local date/time.
2. Pick local timezone.
3. Click **Convert to MCT**.
- **MCT→Local**:
1. Enter MCT time/date or MCT epoch counter (or both).
2. Pick your local timezone.
3. Click **Convert to Local**.
---
## How It Works
1. **Fetching Server Time**
- On page load, we try `worldtimeapi.org (UTC)`, `timeapi.io (UTC)`, and `worldtimeapi.org (IP-based)` in order.
- Once one succeeds, we note the offset between their UTC and the user’s `Date.now()`.
- If all fail, we show a warning and use device time anyway.
2. **MCT Calculation**
- MCT is simply **UTC-6**. So we do `serverTime - (6 hours)`.
- The MCT counter is `(serverTimeMillis - baselineMillis) / 1000`, ignoring leap seconds.
3. **Conversions**
- **Local→MCT**: Local date/time → real UTC → minus 6 → MCT.
- **MCT→Local**: If using the MCT counter, interpret that real UTC moment as “UTC,” then let Luxon *display* it in “UTC-6,” and finally convert to your local zone.
---
## Known Limitations
1. **Public Time APIs**
- They can occasionally fail or change. For large-scale usage, consider hosting your own time service.
2. **One-Time Fetch**
- We only fetch once on load. If the user leaves the page open for hours, minor drift can occur.
3. **No Leap Second Handling**
- By design, MCT’s epoch count is linear (like Unix time, ignoring leap seconds).
4. **Local Device Clock**
- If all APIs fail, we revert to the device clock. An on-screen banner warns about potential inaccuracy.
---
## Why MCT?
**Metaverse Cyber Time** addresses many constraints of standard UTC:
- **No DST**: Always UTC-6.
- **Human-Readable**: A built-in date/time format (ISO style).
- **Continuous Counter**: No leap second interruptions.
- **Potentially Helpful** for blockchain, AI, scheduling, and distributed systems needing an unbroken timeline.
---
## License
MIT License
Copyright (c) 2025 Metaverse Radio, LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
**Enjoy exploring MCT!**
If you have any questions, suggestions, or issues, feel free to open an issue or pull request.
For a deeper explanation, consult the [Comprehensive MCT Overview](#) that aligns with this code.
-->