View Javadoc

1   /*$Id: TimeStamp.java,v 1.1 2005/03/22 13:00:41 mch Exp $
2    *
3    * Copyright (C) AstroGrid. All rights reserved.
4    *
5    * This software is published under the terms of the AstroGrid
6    * Software License version 1.2, a copy of which has been included
7    * with this distribution in the LICENSE.txt file.
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  $Log: TimeStamp.java,v $
39  Revision 1.1  2005/03/22 13:00:41  mch
40  Seperated utils from common
41  
42  Revision 1.1  2004/10/01 17:52:18  mch
43  Added simple timestamp
44  
45  Revision 1.1  2004/05/25 13:35:05  mch
46  Trivial timestamp utility
47  
48   */
49  
50  
51  
52