Revision 104,
1.0 KB
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[104] | 1 | package org.joda.time; |
---|
| 2 | |
---|
| 3 | import java.util.Calendar; |
---|
| 4 | |
---|
| 5 | import org.apache.commons.logging.Log; |
---|
| 6 | import org.apache.commons.logging.LogFactory; |
---|
| 7 | |
---|
| 8 | import eduni.simjava.Sim_system; |
---|
| 9 | |
---|
| 10 | /** |
---|
| 11 | * |
---|
| 12 | * @author Marcin Krystek |
---|
| 13 | * |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | public class VCMilisProvider extends DateTimeUtils.MillisProvider { |
---|
| 17 | |
---|
| 18 | private Log log = LogFactory.getLog(VCMilisProvider.class); |
---|
| 19 | |
---|
| 20 | // start time offset |
---|
| 21 | protected long startTime; |
---|
| 22 | |
---|
| 23 | public VCMilisProvider(Calendar initTime){ |
---|
| 24 | |
---|
| 25 | // cut milliseconds |
---|
| 26 | String msg = "Cut start time milliseconds " + initTime.getTime() + |
---|
| 27 | " (" + initTime.getTimeInMillis() + ") to "; |
---|
| 28 | |
---|
| 29 | initTime.set(Calendar.MILLISECOND, 0); |
---|
| 30 | |
---|
| 31 | log.debug(msg + initTime.getTime() + |
---|
| 32 | " (" + initTime.getTimeInMillis() + ")"); |
---|
| 33 | |
---|
| 34 | this.startTime = initTime.getTimeInMillis(); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | long getMillis() { |
---|
| 38 | |
---|
| 39 | long vc = Math.round(Sim_system.clock()); |
---|
| 40 | //System.out.println("SIMJAVA TIME: "+Sim_system.clock()); |
---|
| 41 | //System.out.println("CLOUD TIME: "+GSSIM.clock()); |
---|
| 42 | |
---|
| 43 | // change virtual seconds to milliseconds |
---|
| 44 | vc = vc * 1000; |
---|
| 45 | |
---|
| 46 | return this.startTime + vc; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.