Revision 494,
1006 bytes
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
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 | |
---|
42 | // change virtual seconds to milliseconds |
---|
43 | vc = vc * 1000; |
---|
44 | |
---|
45 | return this.startTime + vc; |
---|
46 | } |
---|
47 | |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.