]> git.basschouten.com Git - openhab-addons.git/blob
90ced4f4857b0df23aec1c7c26a1e80723538101
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.deutschebahn.internal.timetable;
14
15 import java.util.Calendar;
16 import java.util.Date;
17 import java.util.GregorianCalendar;
18 import java.util.function.Supplier;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21
22 /**
23  * Stub time provider.
24  * 
25  * @author Sönke Küper - Initial contribution.
26  */
27 @NonNullByDefault
28 public final class TimeproviderStub implements Supplier<Date> {
29
30     public GregorianCalendar time = new GregorianCalendar();
31
32     @Override
33     public Date get() {
34         return this.time.getTime();
35     }
36
37     public void moveAhead(int seconds) {
38         this.time.set(Calendar.SECOND, time.get(Calendar.SECOND) + seconds);
39     }
40 }