local d=game:GetService("\082\117\110\083\101\114\118\105\099\101")local h=require(script.Parent.Observable)local e=h.new(os.time,function(h)local e=os.time()local O=d.Heartbeat:Connect(function()local d=os.time()if d~=e then e=d h()end end)return function()O:Disconnect()end end)return e
--!strict
local RunService = game:GetService("RunService")
local Observable = require(script.Parent.Observable)

--[=[
    @prop Clock Observable<number>
    @within Dex

    Observable number that derives its value from the current time in seconds
    in UTC (i.e. the value returned by `os.time()`)

    While subscribed, `Dex.Clock` automatically updates its value whenever the
    value of `os.time()` changes.
]=]

local Clock = Observable.new(
    os.time,
    function(notifyUpdate)
        local lastTime = os.time()
        local conn = RunService.Heartbeat:Connect(function()
            local nextTime = os.time()
            if nextTime ~= lastTime then
                lastTime = nextTime
                notifyUpdate()
            end
        end)
        return function()
            conn:Disconnect()
        end
    end
)

return Clock