Skip to content
File

Blob: src/workerd/io/io-util.c++

441 bytes
1// Copyright (c) 2017-2022 Cloudflare, Inc.
2// Licensed under the Apache 2.0 license found in the LICENSE file or at:
3// https://opensource.org/licenses/Apache-2.0
4 
5#include "io-util.h"
6 
7#include "io-context.h"
8 
9#include <kj/time.h>
10 
11namespace workerd {
12 
13double dateNow() {
14 KJ_IF_SOME(ioContext, IoContext::tryCurrent()) {
15 return (ioContext.now() - kj::UNIX_EPOCH) / kj::MILLISECONDS;
16 }
17 
18 return 0.0;
19}
20 
21} // namespace workerd