1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.utils;
12
13
14 /***
15 * Timer - simple utility class for marking time passed
16 * @author : M Hill
17 *
18 * Creates a date instance (with time now) on creation, and user can then call
19 * 'getSecs' to get seconds since the instantiation time. Add more methods as
20 * required.
21 */
22
23 import java.util.Date;
24
25 public class TimeStamp extends Date
26 {
27 /***
28 * Returns the number of seconds since the timestamp
29 */
30 public long getSecsSince()
31 {
32 Date nowTime = new Date();
33 return (nowTime.getTime() - getTime()) / 1000;
34 }
35 }
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52