2022-04-26 14:35:16 +00:00
const maxtimestamp = 2147483647 ;
var readable _timer _mode = 0 ;
var msec _display = true ;
var fullscreen = false ;
var other _counters = [ // Title EN, Title RU, Start Unix timestamp, End Unix timestamp, Description EN, Description RU
[ "UNIX unsinged 32-bit timestamp" , "UNIX 32 бита без знака" , 0 n , 4294967295 n , "Developers of some systems have thought that singed 32-bit may not be enough and decided to use unsinged 32-bit." , "Разработчики некоторых систем додумались, что 32 бита с о знаком однажды может не хватить и решили использовать 32 бита без знака." ] ,
2022-04-26 19:17:37 +00:00
[ "FAT filesystems timestamps" , "Штампы времени файловой системы FAT" , 315532800 n , 4354819198 n , "" , "Н а каждую отметку времени отводится четыре байта: два - на дату и два - на время. Год хранится в формате количества лет от начала эпохи Microsoft. Отсюда и диапазон - от 1980 до 2107 года" ] ,
2022-04-26 19:25:23 +00:00
[ "ext4 filesystems timestamps" , "Штампы времени файловой системы ext4" , - 2147483648 n , 15032385529 n , "Inode Timestamps" , "" ] ,
2022-04-26 19:17:37 +00:00
[ "NTFS filesystems timestamps" , "Штампы времени файловой системы NTFS" , - 11644473600 n , 1833029984880 n , "File times are 64-bit numbers counting 100-nanosecond intervals (ten million per second) since 1601, which is 58,000+ years" , "Для хранения даты и времени отведено 64 бита; шаг — 100 наносекунд (десять миллионов интервалов в секунду). Это позволяет указать дату и время в промежутке из 58 тысяч лет." ] ,
2022-04-26 14:35:16 +00:00
// ["Year 32,768 bug", "Проблема 32 768 года", -62167219200, 971890963200, "", ""],
// ["Year 65,536 bug", "Проблема 65 536 года", -62167219200, 2005949145600, "", ""],
[ "UNIX singed 64-bit timestamp" , "UNIX 64 бита с о знаком" , 0 n , 9223372036854775807 n , "Proposed as a solution to problem 2038 and turns it into problem 292277026596 because the extreme time that can be represented by this format is December 4, 292,277,026,596, 15:30:08 UTC." , "Предлагается в качестве решения проблемы 2038 и превращает её в проблему 292277026596 года, потому что крайнее время, которое может быть представлено данным форматом - 4 Декабря 292 277 026 596 года, 15:30:08 UTC." ] ,
2022-04-26 19:17:37 +00:00
[ "UNIX unsinged 64-bit timestamp" , "UNIX 64 бита без знака" , 0 n , 18446744073709551615 n , "Humanity will never get to November 29, 584,554,051,223, 16:51:49 UTC, don't worry" , "Человечество никогда не доживёт до 29 ноября 584 554 051 223 года, 16:51:49 UTC, не волнуйтесь" ] ,
2022-04-26 14:35:16 +00:00
] ;
var language _user = window . navigator ? ( window . navigator . language ||
window . navigator . systemLanguage ||
window . navigator . userLanguage ) : "ru" ;
language _user = language _user . substr ( 0 , 2 ) . toLowerCase ( ) ;
language _site = ( language _user == "ru" || language _user == "by" || language _user == "ua" ) ? "ru" : "en" ;
function ReadableTimerSwitcher ( ) {
readable _timer _mode ++
if ( readable _timer _mode > 2 ) { readable _timer _mode = 0 }
}
addEventListener ( "fullscreenchange" , ( event ) => {
if ( ! fullscreen ) {
$ ( "#style" ) . attr ( "href" , "fullscreen-style.css" ) ;
$ ( "#description_en" ) . css ( "display" , "none" ) ;
$ ( "#description_ru" ) . css ( "display" , "none" ) ;
fullscreen = true ;
} else {
$ ( "#style" ) . attr ( "href" , "style.css" ) ;
languageSwitcher ( language _site )
fullscreen = false ;
}
} )
function languageSwitcher ( lang _code ) {
switch ( lang _code ) {
case "ru" :
$ ( "#title_en" ) . css ( "display" , "none" ) ;
$ ( "#title_ru" ) . css ( "display" , "block" ) ;
$ ( "#description_en" ) . css ( "display" , "none" ) ;
$ ( "#description_ru" ) . css ( "display" , "block" ) ;
$ ( "#me_tg_en" ) . css ( "display" , "none" ) ;
$ ( "#me_tg_ru" ) . css ( "display" , "" ) ;
language _site = "ru" ;
break ;
case "en" :
$ ( "#title_ru" ) . css ( "display" , "none" ) ;
$ ( "#title_en" ) . css ( "display" , "block" ) ;
$ ( "#description_ru" ) . css ( "display" , "none" ) ;
$ ( "#description_en" ) . css ( "display" , "block" ) ;
$ ( "#me_tg_ru" ) . css ( "display" , "none" ) ;
$ ( "#me_tg_en" ) . css ( "display" , "" ) ;
language _site = "en" ;
break ;
}
}
languageSwitcher ( language _site ) ;
function msecDisplaySwitcher ( ) {
if ( msec _display ) {
msec _display = false
$ ( "#time-left-msec" ) . css ( "display" , "none" ) ;
} else {
msec _display = true
$ ( "#time-left-msec" ) . css ( "display" , "unset" ) ;
}
}
function Cycle ( ) {
var timestamp = Date . now ( ) / 1000 ,
left = maxtimestamp - timestamp ,
lmsec = Math . floor ( left * 1000 ) % 1000 ,
t = Math . floor ( left ) ;
$ ( "#time-left" ) . html ( t . toLocaleString ( language _site ) ) ;
$ ( "#time-left-msec" ) . html ( "." + ( "00" + lmsec ) . slice ( - 3 ) )
$ ( "#prog" ) . val ( timestamp ) ;
$ ( "#timestamp_ru" ) . html ( Math . trunc ( timestamp ) . toLocaleString ( language _site ) ) ;
$ ( "#timestamp_en" ) . html ( Math . trunc ( timestamp ) . toLocaleString ( language _site ) ) ;
if ( left < 60 && readable _timer _mode != 2 ) { $ ( "#time-left-readable" ) . css ( "display" , "none" ) }
if ( left <= 0 ) {
clearInterval ( c ) ;
$ ( "#time-left" ) . html ( "0" ) ;
$ ( "#time-left-msec" ) . html ( "000" )
$ ( "#title" ) . html ( "С͓̪̩̳͕͍̄ͮͤ̚̚м̦͎͉̝̋̄е̥͕̫̫̱̱͓̞̾р̞̤̰͖̤̟̫͓̏̍͒ͣ͐͂̚ͅт̗̥̲̩̣̯̹̅ͅь̙͍̟̟̮̩̦̹ͩͤ" ) ;
}
switch ( readable _timer _mode ) {
case 0 :
var tsec = Math . floor ( left % 60 ) ,
tmin = Math . floor ( left / 60 ) % 60 ,
thour = Math . floor ( left / 60 / 60 ) % 24 ,
tday = Math . floor ( left / 60 / 60 / 24 ) ;
$ ( "#time-left-readable" ) . html ( "(" + tday + ":" + ( "0" + thour ) . slice ( - 2 ) + ":" + ( "0" + tmin ) . slice ( - 2 ) + ":" + ( "0" + tsec ) . slice ( - 2 ) + ")" ) ;
break ;
case 1 :
var tsec = Math . floor ( left % 60 ) ,
tmin = Math . floor ( left / 60 ) % 60 ,
thour = Math . floor ( left / 60 / 60 ) % 24 ,
tday = Math . floor ( left / 60 / 60 / 24 ) % 365 ,
tyear = Math . floor ( left / 60 / 60 / 24 / 365 ) ;
$ ( "#time-left-readable" ) . html ( "(" + tyear . toLocaleString ( language _site , { style : "unit" , unit : "year" } ) + " " + tday . toLocaleString ( language _site , { style : "unit" , unit : "day" } ) + " " + ( "0" + thour ) . slice ( - 2 ) + ":" + ( "0" + tmin ) . slice ( - 2 ) + ":" + ( "0" + tsec ) . slice ( - 2 ) + ")" ) ;
break ;
case 2 :
$ ( "#time-left-readable" ) . html ( Math . trunc ( timestamp ) . toLocaleString ( language _site ) + " / " + maxtimestamp . toLocaleString ( language _site ) + " (" + ( timestamp / maxtimestamp ) . toLocaleString ( language _site , { style : "percent" , minimumFractionDigits : 8 } ) + ")" ) ;
break ;
}
let other _counters _html = ( language _site == "ru" ) ? "<h3>Другие, более далёкие проблемы времени в вычислительной технике</h3>" : "<h3>Other, more distant time problems in computing</h3>" ;
other _counters . forEach ( element => {
l = element [ 3 ] - BigInt ( Math . trunc ( timestamp ) ) ;
2022-04-26 19:17:37 +00:00
date _from = new Date ( parseInt ( element [ 2 ] ) * 1000 ) ;
date _to = new Date ( parseInt ( element [ 3 ] ) * 1000 ) ;
date _to _local = new Intl . DateTimeFormat ( language _site , { timeZone : 'UTC' , weekday : 'short' , year : 'numeric' , month : 'short' , day : 'numeric' , hour : 'numeric' , minute : 'numeric' , second : 'numeric' , timeZoneName : 'short' } )
2022-04-26 14:35:16 +00:00
other _counters _html = other _counters _html + '<div id="other_counter"><h4>' + element [ ( language _site == "ru" ) ? 1 : 0 ] + '</h4><span style="font-size: 2rem; font-family: \'7Digital\'">'
+ l . toLocaleString ( language _site ) + '</span><div class="othr_progress" style="float: right">' // second argument: {notation: "compact", compactDisplay: "long", style: "unit", unit: "second", unitDisplay: 'long'}
+ ( ( timestamp - parseInt ( element [ 2 ] ) ) / ( parseInt ( element [ 3 ] ) - parseInt ( element [ 2 ] ) ) ) . toLocaleString ( language _site , { style : "percent" , minimumFractionDigits : 8 } )
2022-04-26 19:17:37 +00:00
+ " · " ; try { other _counters _html = other _counters _html + date _to _local . format ( date _from ) } catch ( e ) { other _counters _html = other _counters _html + ( ( element [ 2 ] / 60 n / 60 n / 24 n / 365 n ) + 1970 n ) . toLocaleString ( language _site , { style : "unit" , unit : "year" } ) } ; other _counters _html = other _counters _html + " ‒ " ; try { other _counters _html = other _counters _html + date _to _local . format ( date _to ) } catch ( e ) { other _counters _html = other _counters _html + ( ( element [ 3 ] / 60 n / 60 n / 24 n / 365 n ) + 1970 n ) . toLocaleString ( language _site , { style : "unit" , unit : "year" } ) } ; other _counters _html = other _counters _html
2022-04-26 14:35:16 +00:00
+ ' · ' + ( l / 60 n / 60 n / 24 n / 365 n ) . toLocaleString ( language _site , { style : "unit" , unit : "year" } ) + ' ' + ( l / 60 n / 60 n / 24 n % 365 n ) . toLocaleString ( language _site , { style : "unit" , unit : "day" } ) + ' ' + ( "0" + ( l / 60 n / 60 n % 24 n ) ) . slice ( - 2 ) + ':' + ( "0" + ( l / 60 n % 60 n ) ) . slice ( - 2 ) + ':' + ( "0" + ( l % 60 n ) ) . slice ( - 2 )
+ '</div><p>' + element [ ( language _site == "ru" ) ? 5 : 4 ] + '</p></div>' ;
} ) ;
$ ( "#other_countdowns" ) . html ( other _counters _html )
}
2022-01-31 19:41:53 +00:00
var c = setInterval ( Cycle , 1000 / 15 ) ;