1 /* Copyright 2002-2024 CS GROUP 2 * Licensed to CS GROUP (CS) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * CS licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.orekit.time; 18 19 import java.io.Serializable; 20 21 /** TAI UTC offset model. 22 * @see UTCTAIOffsetsLoader 23 * @author Luc Maisonobe 24 * @since 7.1 25 */ 26 public class OffsetModel implements Serializable { 27 28 /** Serializable UID. */ 29 private static final long serialVersionUID = 20240721L; 30 31 /** Date of the offset start. */ 32 private final DateComponents start; 33 34 /** Reference date of the linear model as a modified julian day. */ 35 private final int mjdRef; 36 37 /** Offset at reference date in seconds (TAI minus UTC). */ 38 private final TimeOffset offset; 39 40 /** Offset slope in nanoseconds per UTC second (TAI minus UTC / dUTC). */ 41 private final int slope; 42 43 /** Constructor for a linear offset model. 44 * <p> 45 * These models were used prior to 1972. 46 * </p> 47 * @param start date of the offset start 48 * @param mjdRef reference date of the linear model as a modified julian day 49 * @param offset offset at reference date in seconds (TAI minus UTC) 50 * @param slope offset slope in nanoseconds per UTC second (TAI minus UTC / dUTC) 51 */ 52 public OffsetModel(final DateComponents start, 53 final int mjdRef, final TimeOffset offset, final int slope) { 54 this.start = start; 55 this.mjdRef = mjdRef; 56 this.offset = offset; 57 this.slope = slope; 58 } 59 60 /** Constructor for a constant offset model. 61 * <p> 62 * These models are used since 1972. 63 * </p> 64 * @param start date of the offset start 65 * @param offset offset at reference date in seconds (TAI minus UTC) 66 */ 67 public OffsetModel(final DateComponents start, final int offset) { 68 this(start, 41317, new TimeOffset(offset, 0L), 0); 69 } 70 71 /** Get the date of the offset start. 72 * @return date of the offset start 73 */ 74 public DateComponents getStart() { 75 return start; 76 } 77 78 /** Get the reference date of the linear model as a modified julian day. 79 * @return reference date of the linear model as a modified julian day 80 */ 81 public int getMJDRef() { 82 return mjdRef; 83 } 84 85 /** Offset at reference date in seconds (TAI minus UTC). 86 * @return offset at reference date in seconds (TAI minus UTC) 87 */ 88 public TimeOffset getOffset() { 89 return offset; 90 } 91 92 /** Offset slope in nanoseconds per UTC second (TAI minus UTC / dUTC). 93 * @return offset slope in nanoseconds per UTC second (TAI minus UTC / dUTC) 94 */ 95 public int getSlope() { 96 return slope; 97 } 98 99 }