- static final Logger logger = Logger.getLogger(DmaapTimestamp.class);
- private static Calendar cal = Calendar.getInstance();
- private Date stamp;
-
- public DmaapTimestamp() {
-
- stamp = cal.getTime();
- logger.info("constructor: set val to " + stamp);
- }
-
- public void mark() {
- stamp = cal.getTime();
- logger.info("mark: set val to " + stamp);
- }
-
- public Date getVal() {
- return stamp;
- }
+ private Date stamp;
+
+ public DmaapTimestamp() {
+ this(new Date());
+ }
+
+ DmaapTimestamp(Date stamp) {
+ this.stamp = new Date(stamp.getTime());
+ }
+
+ public void mark() {
+ stamp = new Date();
+ }
+
+ public Date getVal() {
+ return new Date(stamp.getTime());
+ }