All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.stepfunc.dnp3.Timestamp Maven / Gradle / Ivy

// This library is provided under the terms of a non-commercial license.
// 
// Please refer to the source repository for details:
// 
// https://github.com/stepfunc/dnp3/blob/master/LICENSE.txt
// 
// Please contact Step Function I/O if you are interested in commercial license:
// 
// [email protected]
package io.stepfunc.dnp3;

import org.joou.*;

/**
 * Timestamp value
 */
public final class Timestamp
{
    /**
     * Timestamp value
     */
    public ULong value;
    /**
     * Timestamp quality
     */
    public TimeQuality quality;
    /**
     * Timestamp value
     */
    public Timestamp withValue(ULong value)
    {
        this.value = value;
        return this;
    }
    /**
     * Timestamp quality
     */
    public Timestamp withQuality(TimeQuality value)
    {
        this.quality = value;
        return this;
    }
    
    /**
     * Creates an invalid timestamp struct
     * 
     * 

Values are initialized to: *

    *
  • {@link Timestamp#value} : 0
  • *
  • {@link Timestamp#quality} : {@link TimeQuality#INVALID_TIME}
  • *

* * @return Initialized {@link Timestamp} instance */ public static Timestamp invalidTimestamp() { return new Timestamp(ULong.valueOf(0L), TimeQuality.INVALID_TIME); } /** * Creates a synchronized timestamp struct * *

Values are initialized to: *

    *
  • {@link Timestamp#quality} : {@link TimeQuality#SYNCHRONIZED_TIME}
  • *

* * @param value Timestamp value * @return Initialized {@link Timestamp} instance */ public static Timestamp synchronizedTimestamp(ULong value) { return new Timestamp(value, TimeQuality.SYNCHRONIZED_TIME); } /** * Creates an unsynchronized timestamp struct * *

Values are initialized to: *

    *
  • {@link Timestamp#quality} : {@link TimeQuality#UNSYNCHRONIZED_TIME}
  • *

* * @param value Timestamp value * @return Initialized {@link Timestamp} instance */ public static Timestamp unsynchronizedTimestamp(ULong value) { return new Timestamp(value, TimeQuality.UNSYNCHRONIZED_TIME); } private Timestamp(ULong value, TimeQuality quality) { this.value = value; this.quality = quality; } void _assertFieldsNotNull() { java.util.Objects.requireNonNull(value, "value cannot be null"); java.util.Objects.requireNonNull(quality, "quality cannot be null"); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy