KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > util > TimestampCopy


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: TimestampCopy.java,v 1.5 2007/01/07 06:14:01 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.core.util;
23
24 import java.sql.Timestamp JavaDoc;
25
26 /**
27  * Timestamp which adds copy constructor which correctly copies nanosecond
28  * portion of the original timestamp.
29  *
30  * @version $Id: TimestampCopy.java,v 1.5 2007/01/07 06:14:01 bastafidli Exp $
31  * @author Miro Halas
32  * @code.reviewer Miro Halas
33  * @code.reviewed 1.3 2006/02/17 06:54:53 bastafidli
34  */

35 public class TimestampCopy extends Timestamp JavaDoc
36 {
37    // Attributes ///////////////////////////////////////////////////////////////
38

39    /**
40     * Generated serial version id for this class.
41     */

42    private static final long serialVersionUID = 135570135998694876L;
43
44    // Constructors /////////////////////////////////////////////////////////////
45

46    /**
47     * Copy constructor which will create exact copy of the timestamp including
48     * the nanosecond portion.
49     *
50     * @param original - original timestamp to copy
51     */

52    public TimestampCopy(
53       Timestamp JavaDoc original
54    )
55    {
56       // Pass the time portion here
57
super(original.getTime());
58       // And now set the correct nanoseconds since it is required.
59
setNanos(original.getNanos());
60    }
61
62    /**
63     * Constructor which will create exact copy of the timestamp including
64     * the nanosecond portion.
65     *
66     * @param lTime - time portion of the timestamp
67     * @param iNanos - nanosecond portion of the timestamp
68     */

69    public TimestampCopy(
70       long lTime,
71       int iNanos
72    )
73    {
74       // Pass the time portion here
75
super(lTime);
76       // And now set the correct nanoseconds since it is required.
77
setNanos(iNanos);
78    }
79 }
80
Popular Tags