mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 08:32:39 +03:00
debug: poor man's pretty @da fractional seconds
Lossy, but if the original ms timestamp came out of an urbit, it was already lossy anyway.
This commit is contained in:
parent
69e357b161
commit
3ecae833ab
@ -13,7 +13,7 @@ export function makeRoutePath(resource, includeQuery = false) {
|
||||
|
||||
export function msToDa(ms, mil) {
|
||||
const d = new Date(ms);
|
||||
var fil = function(n) {
|
||||
const fil = function(n) {
|
||||
return n >= 10 ? n : "0" + n;
|
||||
};
|
||||
return (
|
||||
@ -23,7 +23,10 @@ export function msToDa(ms, mil) {
|
||||
`${fil(d.getUTCHours())}.` +
|
||||
`${fil(d.getUTCMinutes())}.` +
|
||||
`${fil(d.getUTCSeconds())}` +
|
||||
`${mil ? "..0000" : ""}`
|
||||
//NOTE poor man's pretty @da milliseconds
|
||||
`${!mil ? '' :
|
||||
'..' + Math.floor((d.getUTCMilliseconds() / 1000) * 0x10000)
|
||||
.toString(16).padStart(4, '0')}`
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user