/[classpath]/classpath/java/util/Date.java
ViewVC logotype

Diff of /classpath/java/util/Date.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by tromey, Fri Apr 23 20:34:11 2004 UTC revision 1.18 by jfrijters, Tue Oct 12 11:48:32 2004 UTC
# Line 93  public class Date implements Cloneable, Line 93  public class Date implements Cloneable,
93     */     */
94    public Date(int year, int month, int day)    public Date(int year, int month, int day)
95    {    {
96      time = new GregorianCalendar(year + 1900, month, day).getTimeInMillis();      this(year, month, day, 0, 0, 0);
97    }    }
98    
99    /**    /**
# Line 103  public class Date implements Cloneable, Line 103  public class Date implements Cloneable,
103     */     */
104    public Date(int year, int month, int day, int hour, int min)    public Date(int year, int month, int day, int hour, int min)
105    {    {
106      time =      this(year, month, day, hour, min, 0);
       new GregorianCalendar(year + 1900, month, day, hour,  
                             min).getTimeInMillis();  
107    }    }
108    
109    /**    /**
110     * Creates a new Date Object representing the given time.     * Creates a new Date Object representing the given time.
111     * @deprecated use <code>new GregorianCalendar(year+1900, month,     * @deprecated use <code>new GregorianCalendar(year+1900, month,
112     * day)</code> instead.       * day, hour, min, sec)</code> instead.  
113     */     */
114    public Date(int year, int month, int day, int hour, int min, int sec)    public Date(int year, int month, int day, int hour, int min, int sec)
115    {    {
116      time =      GregorianCalendar cal = new GregorianCalendar(year + 1900, 0, 1);
117        new GregorianCalendar(year + 1900, month, day, hour, min,      int dst = cal.get(Calendar.DST_OFFSET);
118                              sec).getTimeInMillis();      cal.add(GregorianCalendar.MONTH, month);
119        cal.add(GregorianCalendar.DAY_OF_MONTH, day - 1);
120        cal.add(GregorianCalendar.HOUR, hour);
121        cal.add(GregorianCalendar.MINUTE, min);
122        cal.add(GregorianCalendar.SECOND, sec);
123        time = cal.getTimeInMillis() + dst - cal.get(Calendar.DST_OFFSET);
124    }    }
125    
126    /**    /**
# Line 178  public class Date implements Cloneable, Line 181  public class Date implements Cloneable,
181    {    {
182      Calendar cal = Calendar.getInstance();      Calendar cal = Calendar.getInstance();
183      cal.setTimeInMillis(time);      cal.setTimeInMillis(time);
184      return (cal.get(Calendar.ZONE_OFFSET)      return - (cal.get(Calendar.ZONE_OFFSET)
185              + cal.get(Calendar.DST_OFFSET)) / (60 * 1000);              + cal.get(Calendar.DST_OFFSET)) / (60 * 1000);
186    }    }
187    

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26