Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4015483

java.sql.Timestamp(long) constructor works wrong with negative values

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1beta3
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description

      Seconds value may be incorrect:
      ===== Here is the minimized test =====
      import java.sql.Timestamp;
      class java_sql_Timestamp1 {
        public static void main (String args[]) {
            Timestamp t=new Timestamp(-1800);
            System.out.println("t = " + t.toString());
            System.out.println("t = " + t.toGMTString()); //should print
                                             // "t = 31 Dec 1969 23:59:58 GMT"
            System.out.println("t.getTime() = " + t.getTime()); //should print
                                             // "-2000"
        }
      }
      ===== Here is the output of the test =====
      t = 1969-12-31 15:59:58.2
      t = 31 Dec 1969 23:59:59 GMT
      t.getTime() = -1001

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mhapnersunw Mark Hapner (Inactive)
              Reporter:
              mgorshen Mikhail Gorshenev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: