동일한 문제가있었습니다. 삼성 스마트 TV의 new Date()
은 현재 설정에 따라 시간을 얻지 못하며 기본 시스템 시간을 얻습니다. 항상 UTC 타임 스탬프를 반환합니다.
다행히도 API 함수 (GetEpochTime()
)를 사용하면이를 고칠 수 있습니다.
은 여기에 삼성의 플랫폼에서 사용하고 코드입니다 : 지금 내 2013 삼성 스마트 TV의 현재 시간을 표시 잘 작동
(function (OldDate) {
// Get a reference to Samsung's TIME API
var time = document.createElement('object');
time.setAttribute('classid', 'clsid:SAMSUNG-INFOLINK-TIME');
document.body.appendChild(time);
// Replace the existing Date() constructor
window.Date = function (a, b, c, d, e, f, g) {
switch (arguments.length) {
case 0:
return new OldDate(time.GetEpochTime() * 1000);
case 1: return new OldDate(a);
case 2: return new OldDate(a, b);
case 3: return new OldDate(a, b, c);
case 4: return new OldDate(a, b, c, d);
case 5: return new OldDate(a, b, c, d, e);
case 6: return new OldDate(a, b, c, d, e, f);
case 7: return new OldDate(a, b, c, d, e, f, g);
}
};
// Copy static function properties
Date.now = function() { return time.GetEpochTime() * 1000; };
Date.UTC = OldDate.UTC;
Date.parse = OldDate.parse;
})(Date);
new Date()
. 그러나 타임 스탬프를 현재 시간과 비교할 때 여전히 문제가있을 수 있습니다.
너무 넓다고 생각하지 않습니다. Andrei 님, 코드 샘플을 몇 개 삽입하고 자신의 질문을 다시 열어 볼 수도 있습니다. – peterh