<commit_before>// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.test;

import com.google.inject.Inject;
import java.time.Clock;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAmount;

/** 
 * A clock which initially has the time of its creation but can only be advanced by calling advance
 * 
 * @author bratseth
 */
public class ManualClock extends Clock {

    private Instant currentTime = Instant.now();

    @Inject
    public ManualClock() {}

    public ManualClock(String utcIsoTime) {
        this(at(utcIsoTime));
    }

    public ManualClock(Instant currentTime) {
        this.currentTime = currentTime;
    }

    public void advance(TemporalAmount temporal) {
        currentTime = currentTime.plus(temporal);
    }

    @Override
    public Instant instant() { return currentTime; }

    @Override
    public ZoneId getZone() { return null; }

    @Override
    public Clock withZone(ZoneId zone) { return null; }

    @Override
    public long millis() { return currentTime.toEpochMilli(); }
<commit_msg>Add setInstant(Instant) to ManualClock<commit_after>// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.test;

import com.google.inject.Inject;
import java.time.Clock;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAmount;

/** 
 * A clock which initially has the time of its creation but can only be advanced by calling advance
 * 
 * @author bratseth
 */
public class ManualClock extends Clock {

    private Instant currentTime = Instant.now();

    @Inject
    public ManualClock() {}

    public ManualClock(String utcIsoTime) {
        this(at(utcIsoTime));
    }

    public ManualClock(Instant currentTime) {
        this.currentTime = currentTime;
    }

    public void advance(TemporalAmount temporal) {
        currentTime = currentTime.plus(temporal);
    }

    public void setInstant(Instant time) {
        currentTime = time;
    }

    @Override
    public Instant instant() { return currentTime; }

    @Override
    public ZoneId getZone() { return null; }

    @Override
    public Clock withZone(ZoneId zone) { return null; }

    @Override
    public long millis() { return currentTime.toEpochMilli(); }

{'fraction_non_alphanumeric': 0.08829174664107485, 'fraction_numerical': 0.004606525911708253, 'mean_word_length': 3.47766323024055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4039729', 'n_tokens_mistral': 788, 'n_tokens_neox': 719, 'n_words': 229}