• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats.java / #1997

20 Jun 2025 12:27PM UTC coverage: 95.66% (-0.03%) from 95.69%
#1997

push

github

web-flow
Merge pull request #1334 from nats-io/timers-move-to-nano

Nano time for elapsed timings and Nats System Clock

78 of 84 new or added lines in 14 files covered. (92.86%)

1 existing line in 1 file now uncovered.

11748 of 12281 relevant lines covered (95.66%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/src/main/java/io/nats/client/NatsSystemClock.java
1
// Copyright 2025 The NATS Authors
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at:
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13

14
package io.nats.client;
15

NEW
16
public class NatsSystemClock {
×
17
    private static NatsSystemClockProvider PROVIDER = new NatsSystemClockProvider() {};
1✔
18

19
    public static void setProvider(final NatsSystemClockProvider provider) {
NEW
20
        PROVIDER = provider == null ? new NatsSystemClockProvider() {} : provider;
×
NEW
21
    }
×
22

23
    public static long currentTimeMillis() {
24
        return PROVIDER.currentTimeMillis();
1✔
25
    }
26

27
    public static long nanoTime() {
28
        return PROVIDER.nanoTime();
1✔
29
    }
30
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc