src/java.sql/share/classes/java/sql/Timestamp.java
changeset 48065 c4f2b6749c86
parent 47216 71c04702a3d5
equal deleted inserted replaced
48064:390794d000e6 48065:c4f2b6749c86
    25 
    25 
    26 package java.sql;
    26 package java.sql;
    27 
    27 
    28 import java.time.Instant;
    28 import java.time.Instant;
    29 import java.time.LocalDateTime;
    29 import java.time.LocalDateTime;
    30 import jdk.internal.misc.SharedSecrets;
       
    31 import jdk.internal.misc.JavaLangAccess;
       
    32 
    30 
    33 /**
    31 /**
    34  * <P>A thin wrapper around {@code java.util.Date} that allows
    32  * <P>A thin wrapper around {@code java.util.Date} that allows
    35  * the JDBC API to identify this as an SQL {@code TIMESTAMP} value.
    33  * the JDBC API to identify this as an SQL {@code TIMESTAMP} value.
    36  * It adds the ability
    34  * It adds the ability
    71  * denotes implementation inheritance, and not type inheritance.
    69  * denotes implementation inheritance, and not type inheritance.
    72  *
    70  *
    73  * @since 1.1
    71  * @since 1.1
    74  */
    72  */
    75 public class Timestamp extends java.util.Date {
    73 public class Timestamp extends java.util.Date {
    76 
       
    77     private static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
       
    78 
    74 
    79     /**
    75     /**
    80      * Constructs a {@code Timestamp} object initialized
    76      * Constructs a {@code Timestamp} object initialized
    81      * with the given values.
    77      * with the given values.
    82      *
    78      *
   311         buf[yearSize + 12] = ':';
   307         buf[yearSize + 12] = ':';
   312         Date.formatDecimalInt(second, buf, yearSize + 13, 2);
   308         Date.formatDecimalInt(second, buf, yearSize + 13, 2);
   313         buf[yearSize + 15] = '.';
   309         buf[yearSize + 15] = '.';
   314         Date.formatDecimalInt(tmpNanos, buf, yearSize + 16, 9 - trailingZeros);
   310         Date.formatDecimalInt(tmpNanos, buf, yearSize + 16, 9 - trailingZeros);
   315 
   311 
   316         return jla.newStringUnsafe(buf);
   312         return new String(buf);
   317     }
   313     }
   318 
   314 
   319     /**
   315     /**
   320      * Gets this {@code Timestamp} object's {@code nanos} value.
   316      * Gets this {@code Timestamp} object's {@code nanos} value.
   321      *
   317      *