|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.engine.resource.clock.WorldClock
public class WorldClock
Allows for checking the time in the local time zone and Coordinated Universal Time (UTC). The local time zone by default is UTC, but this can be set to any time zone using the TimeZone class or any time zone unique string ids set up by the TimeZone class such as "EST" or "Pacific Standard Time" or "GMT+10" or "America/Los_Angelos". A complete list of available time zones can be found at http://mindprod.com/jgloss/timezone.html The local or UTC time can be retrieved as milliseconds since January 1, 1970 00:00:00.00 Individual components of the time from the number of milliseconds in the current time to the current year can also be retrieved. This class can be used to create game events which depend on real world time. For instance, the background of the game could change to mirror the time of day; scenery in the game could reflect the real world season; after 1 hour of the game being open irrespective of how long the game has been running according the game clock the game could display a message telling the user to take a break and go outside like the Wii. WorldClock is dependent upon java.util.Calendar and java.util.TimeZone.
Field Summary | |
---|---|
static int |
DAY
|
static int |
HOUR
|
static int |
MILLISECOND
|
static int |
MINUTE
|
static int |
MONTH
|
static int |
SECOND
|
static int |
YEAR
|
Constructor Summary | |
---|---|
WorldClock()
|
Method Summary | |
---|---|
static long |
getLocalTime()
Returns the current local time measured as millisecond from January 1, 1970 00:00.00 in the local time zone. |
static int |
getLocalTime(int type)
Returns an individual component of the local time and date. |
static long |
getUTCTime()
Returns the current local time measured as millisecond from January 1, 1970 00:00.00 in Coordinated Universal Time. |
static int |
getUTCTime(int type)
Returns an individual component of the UTC time and date. |
static void |
setTimeZone(java.lang.String timeZoneSID)
Set the local time zone with a time zone String id. |
static void |
setTimeZone(java.util.TimeZone tz)
Set the local time zone using a TimeZone object set to the correct time zone. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MILLISECOND
public static final int SECOND
public static final int MINUTE
public static final int HOUR
public static final int DAY
public static final int MONTH
public static final int YEAR
Constructor Detail |
---|
public WorldClock()
Method Detail |
---|
public static void setTimeZone(java.util.TimeZone tz)
tz
- TimeZone object set to the local time zonepublic static void setTimeZone(java.lang.String timeZoneSID)
timeZoneSID
- the String identification of the local time zonepublic static long getLocalTime()
public static int getLocalTime(int type)
integer
- uniquely identifying desired time/date component. These ids
are static constants of the WorldClock class.
public static long getUTCTime()
public static int getUTCTime(int type)
integer
- uniquely identifying desired time/date component. These ids
are static constants of the WorldClock class.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |