-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
487 lines (425 loc) · 15.5 KB
/
index.html
File metadata and controls
487 lines (425 loc) · 15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Orbeat - An innovative octal-based cryptic timestamping system inspired by astronomical cycles. Convert current time to 8-character cryptic codes based on Roman nundinal cycles and spring equinox foundation.">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';">
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 10px;
display: flex;
justify-content: center;
align-items: flex-start;
min-height: 100svh; /* Small viewport height - excludes browser chrome */
min-height: 100vh; /* Fallback for older browsers */
background: linear-gradient(135deg, #1c2331 0%, #24344d 100%);
color: #ffffff;
position: relative;
overflow-x: hidden;
box-sizing: border-box;
padding-top: max(10px, env(safe-area-inset-top));
padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.container {
background-color: rgba(30, 40, 60, 0.95);
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
max-width: 600px;
width: 100%;
z-index: 1;
margin: 0 auto;
box-sizing: border-box;
max-height: calc(100svh - 20px);
max-height: calc(100vh - 20px); /* Fallback */
overflow-y: auto;
}
h1 {
color: #5dade2;
text-align: center;
}
h2 {
color: #5dade2;
text-align: center;
}
.time-display {
font-size: 1.5em;
text-align: center;
margin: 20px 0;
padding: 10px;
border-radius: 5px;
color: #ffffff;
}
.copyable {
background-color: #2c4055;
padding: 10px;
border-radius: 5px;
cursor: pointer;
text-align: center;
margin: 10px 0;
font-size: 1.2em;
font-weight: bold;
color: #58d68d;
border: 1px solid #5dade2;
transition: background-color 0.3s, transform 0.3s;
}
.copyable:hover {
background-color: #364f6b;
}
button {
display: block;
margin: 20px auto;
padding: 10px 20px;
font-size: 1em;
background-color: #2471a3;
color: #ffffff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
button:hover {
background-color: #1f5f8b;
}
.documentation {
margin-top: 30px;
text-align: left;
border-radius: 5px;
color: #ffffff;
}
.documentation h1 {
color: #5dade2;
text-align: center;
margin-bottom: 20px;
}
.documentation h2 {
color: #5dade2;
text-align: left;
margin-top: 20px;
margin-bottom: 10px;
}
.documentation p, .documentation ul, .documentation ol {
margin-bottom: 15px;
}
.documentation ul, .documentation ol {
padding-left: 20px;
}
.documentation code {
background-color: #2c4055;
padding: 2px 4px;
border-radius: 3px;
font-family: monospace;
color: #ffffff;
}
.documentation strong {
font-weight: bold;
color: #58d68d;
}
.footer-made-with {
text-align: center;
margin-top: 20px;
font-size: 0.9em;
color: #d5dbdb;
}
.footer-made-with a {
color: #5dade2;
text-decoration: none;
}
.footer-copyright {
text-align: center;
margin-top: 10px;
font-size: 0.9em;
color: #d5dbdb;
}
.footer-last-updated {
text-align: center;
margin-top: 10px;
font-size: 0.9em;
color: #d5dbdb;
}
#background-art {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.octal-list {
list-style-type: none;
padding-left: 20px;
}
.octal-list li {
text-indent: -20px;
padding-left: 20px;
}
/* Universal mobile viewport and safe area fixes */
@media screen and (max-width: 768px) {
body {
padding: 5px;
padding-top: max(5px, env(safe-area-inset-top));
padding-bottom: max(5px, env(safe-area-inset-bottom));
}
.container {
padding: 15px;
max-width: 100%;
margin-top: 0;
max-height: calc(100svh - 10px);
max-height: calc(100vh - 10px); /* Fallback */
}
h1, h2 {
margin-top: 0;
}
.time-display {
font-size: 1.2em;
}
.copyable {
font-size: 1em;
}
}
@media screen and (max-width: 480px) {
body {
padding: 2px;
padding-top: max(2px, env(safe-area-inset-top));
}
.container {
padding: 10px;
border-radius: 5px;
}
.documentation {
padding: 15px;
}
}
/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
body {
min-height: -webkit-fill-available;
}
}
/* Additional fallback for browsers without svh support */
@supports not (height: 100svh) {
body {
min-height: calc(100vh - 20px);
}
.container {
max-height: calc(100vh - 40px);
}
@media screen and (max-width: 768px) {
.container {
max-height: calc(100vh - 20px);
}
}
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@keyframes pulse {
0%, 100% {
opacity: 0.6;
}
50% {
opacity: 0.8;
}
}
#background-art > g:nth-of-type(2) {
transform-origin: 500px 500px;
animation: rotate 480s linear infinite;
}
#background-art > circle {
animation: pulse 10s infinite;
}
</style>
<title>Orbeat</title>
</head>
<body>
<svg id="background-art" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" preserveAspectRatio="xMidYMid slice">
<defs>
<pattern id="smallGrid" width="15.625" height="15.625" patternUnits="userSpaceOnUse">
<path d="M 15.625 0 L 0 0 0 15.625" fill="none" stroke="#1a2a3a" stroke-width="0.5" />
</pattern>
<pattern id="grid" width="125" height="125" patternUnits="userSpaceOnUse">
<rect width="125" height="125" fill="url(#smallGrid)" />
<path d="M 125 0 L 0 0 0 125" fill="none" stroke="#1a2a3a" stroke-width="1" />
</pattern>
<radialGradient id="alienGlow" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
<stop offset="0%" style="stop-color:rgb(0,255,150);stop-opacity:0.4" />
<stop offset="100%" style="stop-color:rgb(0,100,50);stop-opacity:0" />
</radialGradient>
</defs>
<rect width="100%" height="100%" fill="#0a0a1a" />
<rect width="100%" height="100%" fill="url(#grid)" opacity="0.4" />
<g transform="translate(500,500)">
<g transform="scale(1.5)">
<polygon points="0,-100 70.7,-70.7 100,0 70.7,70.7 0,100 -70.7,70.7 -100,0 -70.7,-70.7" fill="none" stroke="#2ecc71" stroke-width="2" />
<polygon points="0,-50 35.4,-35.4 50,0 35.4,35.4 0,50 -35.4,35.4 -50,0 -35.4,-35.4" fill="none" stroke="#3498db" stroke-width="2" />
<line x1="0" y1="-100" x2="0" y2="-50" stroke="#2ecc71" stroke-width="1" />
<line x1="70.7" y1="-70.7" x2="35.4" y2="-35.4" stroke="#2ecc71" stroke-width="1" />
<line x1="100" y1="0" x2="50" y2="0" stroke="#2ecc71" stroke-width="1" />
<line x1="70.7" y1="70.7" x2="35.4" y2="35.4" stroke="#2ecc71" stroke-width="1" />
<line x1="0" y1="100" x2="0" y2="50" stroke="#2ecc71" stroke-width="1" />
<line x1="-70.7" y1="70.7" x2="-35.4" y2="35.4" stroke="#2ecc71" stroke-width="1" />
<line x1="-100" y1="0" x2="-50" y2="0" stroke="#2ecc71" stroke-width="1" />
<line x1="-70.7" y1="-70.7" x2="-35.4" y2="-35.4" stroke="#2ecc71" stroke-width="1" />
</g>
</g>
<g>
<g transform="translate(700,500)">
<rect x="-20" y="-20" width="40" height="40" fill="none" stroke="#9b59b6" stroke-width="2" transform="rotate(45)" />
<circle cx="0" cy="0" r="15" fill="none" stroke="#9b59b6" stroke-width="2" />
</g>
<g transform="translate(500,250)">
<polygon points="0,-20 17.3,-10 17.3,10 0,20 -17.3,10 -17.3,-10" fill="none" stroke="#f1c40f" stroke-width="2" />
<circle cx="0" cy="0" r="10" fill="none" stroke="#f1c40f" stroke-width="2" />
</g>
<g transform="translate(200,500)">
<rect x="-15" y="-15" width="30" height="30" fill="none" stroke="#1abc9c" stroke-width="2" />
<circle cx="0" cy="0" r="20" fill="none" stroke="#1abc9c" stroke-width="2" />
</g>
<g transform="translate(500,850)">
<polygon points="0,-25 21.7,-12.5 21.7,12.5 0,25 -21.7,12.5 -21.7,-12.5" fill="none" stroke="#e67e22" stroke-width="2" />
<rect x="-10" y="-10" width="20" height="20" fill="none" stroke="#e67e22" stroke-width="2" transform="rotate(45)" />
</g>
</g>
<circle cx="500" cy="500" r="500" fill="url(#alienGlow)"></circle>
</svg>
<div class="container">
<h1>Orbeat</h1>
<div class="time-display">
<div id="local-time"></div>
</div>
<div class="copyable" id="octal-time" onclick="copyToClipboard()">Click to copy Orbeat</div>
<button id="action-button">Refresh Time</button>
<div class="documentation">
<h2>Summary</h2>
<p>Orbeat is an octal-based cryptic timestamping system. It gets its name from a combination of octal, orbit, and beat. This naming reflects the system's structure, which utilizes an octal (base-8) representation to measure time in a continuous, orbit-like cycle based on a rational underlying calendar foundation.</p>
<h2>Background</h2>
<p>Loosely inspired by Swatch Internet Time (.beat time), a decimal time system introduced in 1998 used on ICQ and in the game Phantasy Star Online to facilitate cross-continent gaming, and batch codes used in retail and manufacturing industries for date codes and competitive intelligence. The underlying system draws from proven historical precedents like the Roman 8-day nundinal market cycle and astronomical precision.</p>
<h2>Motivation</h2>
<p>I created this project out of intellectual curiosity and as a practical tool. It was a stimulating exercise that allowed me to combine various concepts across multiple disciplines. I needed an efficient and cryptic timestamping method, like batch codes, to manage public-facing personal documents. I sought to devise an innovative way to balance precision with obscurity by crafting a compact yet noteworthy timestamp code based on rational principles, which would be meaningful to me while remaining ambiguous for others.</p>
<h2>Design Decisions</h2>
<p>My design decisions include:</p>
<ul>
<li>Nundinal Cycle: The proven <strong>Roman 8-day</strong> week structure is a practical foundation for the calendar's rhythm</li>
<li>Historical Certainty: The epoch is an indisputable <strong>historical anchor</strong> point to guarantee absolute certainty</li>
<li>Scientific Precision: The epoch time is fixed with <strong>scientific precision</strong> for an unambiguous temporal reference</li>
<li>Astronomical Accuracy: The <strong>Mean Tropical Year</strong> of ~365.2422 days prevents seasonal drift and ensures ~200 year accuracy</li>
<li>Octal Encoding: Dates use <strong>octal encoding</strong> for mathematical harmony and to require explanation to decode</li>
<li>Cryptic Output: The output is made cryptic via <strong>reversal and truncation</strong> to 8 characters for a compact code</li>
<li>Spring Equinox: The years <strong>align with spring equinox</strong> for practical synchronization for the foreseeable future</li>
<li>Generational Stability: Pattern runs are <strong>~27 years long</strong> providing consistent calendar behavior</li>
<li>Week Zero: The first week <strong>hides</strong> in short years to maintain year-end alignment</li>
</ul>
<h2>Format</h2>
<p><strong>Reversed:</strong>
<code>digit_of_year</code>
<code>week_of_year</code>
<code>day_of_week</code>
<code>fraction_of_day</code>
</p>
<p>A concatenated string consisting of:</p>
<ul>
<li>Years since Epoch formatted in octal</li>
<li>Weeks within the year formatted in octal (2 digits)</li>
<li>Days within the 8-day week formatted in octal</li>
<li>Fractional day component formatted in octal (4 digits)</li>
<li>The concatenated string is then reversed and truncated to 8 characters</li>
</ul>
</div>
<div class="footer-made-with">Made with ✨ <a href="https://github.com/pbierkortte/orbeat">source</a></div>
<div class="footer-copyright">© <span id="currentYear"></span> Pat Bierkortte. All rights reserved.</div>
</div>
<script>
const TROPICAL_YEAR_DAYS = 365.24224853515625;
const DAY_NS = 86400000000000;
const WEEK_DAYS = 8.0;
const DATUM_TT = 1705433.878337198;
const UNIX_EPOCH_TT = 2440587.5;
function is_short_year(orbeat_year) {
const next_equinox = DATUM_TT + ((orbeat_year + 1) * TROPICAL_YEAR_DAYS);
const threshold = 4.0 - (368 - TROPICAL_YEAR_DAYS);
const phase = (next_equinox - DATUM_TT) % WEEK_DAYS;
const is_short = threshold <= phase && phase < 4.0;
const year_size = is_short ? 360 : 368;
const year_start_tt = next_equinox - phase - 360;
return {is_short, year_start_tt, year_size};
}
function to_parts(jd_tt) {
if (!jd_tt) {
const unix_ms = Date.now();
const unix_days = unix_ms / 86400000;
jd_tt = UNIX_EPOCH_TT + unix_days;
}
const total_elapsed_days = jd_tt - DATUM_TT;
let year = Math.floor(total_elapsed_days / TROPICAL_YEAR_DAYS);
let {is_short, year_start_tt, year_size} = is_short_year(year);
if (jd_tt < year_start_tt) {
year -= 1;
({is_short, year_start_tt, year_size} = is_short_year(year));
} else if (jd_tt >= is_short_year(year + 1).year_start_tt) {
year += 1;
({is_short, year_start_tt, year_size} = is_short_year(year));
}
const days_into_year = jd_tt - year_start_tt;
let week = Math.floor(days_into_year / 8);
if (is_short && week < 45) {
week += 1;
}
if (!is_short && year >= 0) {
if (0.0 < (360.0 - days_into_year) && (360.0 - days_into_year) < (2.0 / 86400.0)) {
week = 45;
}
}
week = Math.min(week, 45);
const day = Math.floor(total_elapsed_days % 8);
const nano = Math.floor((total_elapsed_days % 1) * DAY_NS);
return {year, week, day, nano};
}
function to_orbeat(tt) {
const {year, week, day, nano} = to_parts(tt);
const frac = Math.floor((nano * (8**4)) / DAY_NS);
let year_oct = year.toString(8);
if (year < 0) {
year_oct = Math.abs(year).toString(8).replace(/^/, '0');
}
const week_oct = week.toString(8).padStart(2, '0');
const day_oct = day.toString(8);
const frac_oct = frac.toString(8).padStart(4, '0');
return `${year_oct}_${week_oct}_${day_oct}.${frac_oct}`;
}
function to_orbeat8(tt) {
const full = to_orbeat(tt);
const concatenated = full.replace(/[_\.]/g, '');
return concatenated.split('').reverse().join('').substring(0, 8);
}
function updateTime() {
const now = new Date();
document.getElementById('local-time').textContent = `Local Time: ${now.toLocaleString()}`;
const octalTime = to_orbeat8();
document.getElementById('octal-time').textContent = octalTime;
}
function copyToClipboard() {
const text = document.getElementById('octal-time').textContent;
navigator.clipboard.writeText(text).then(() => {
alert('Copied to clipboard!');
});
}
function setCurrentYear() {
const currentYear = new Date().getFullYear();
document.getElementById('currentYear').textContent = currentYear;
}
const button = document.getElementById('action-button');
button.onclick = updateTime;
updateTime();
setCurrentYear();
window.onload = setCurrentYear;
</script>
</body>
</html>