com.planet_ink.coffee_mud.Libraries.interfaces
Interface TimeManager

All Superinterfaces:
java.lang.Cloneable, CMLibrary, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
CoffeeTime

public interface TimeManager
extends CMLibrary


Field Summary
static long MILI_DAY
          constant for the number of milliseconds in a rl day
static long MILI_HOUR
          constant for the number of milliseconds in a rl hour
static long MILI_MINUTE
          constant for the number of milliseconds in a minute
static long MILI_MONTH
          constant for the number of milliseconds in a rl month
static long MILI_SECOND
          constant for the number of milliseconds in a second
static long MILI_WEEK
          constant for the number of milliseconds in a rl week
static long MILI_YEAR
          constant for the number of milliseconds in a rl year
static java.lang.String[] MONTHS
          constant for the names of the months in a rl year
static java.lang.String[] SHORTMONTHS
          constant for the short names of the months in a rl year
 
Method Summary
 java.lang.String convertHour(java.lang.String hours24)
          Returns the regular Hours given the hours in the international format (military time) Usage: ConvertHour(GetIn(req, "ENDHR"))
 java.lang.String date2AMPMString(long time)
          Returns the Minutes portion of a given Time Usage: String ST_AMPM=date2AMPMString(time);
 java.lang.String date2APTimeString(long time)
          Return the time in HH:MM AP format.
 java.lang.String date2BestShortEllapsedTime(long t)
          Picks the single best representation of the given ellapsed time, from seconds to minutes to hours to days, and returns the correct amount along with the single letter suffix
 java.lang.String date2BriefString(long time)
          Returns time in HH:MMap format, unless the day is other than today, in which case it prepends yy/m/d.
 java.lang.String date2Date2String(long time)
          Converts a given date into a string of form: MM/DD/YY Usage: date2Date2String(time)
 java.lang.String date2DateString(long time)
          Converts a given date into a string of form: MM/DD/YYYY Usage: date2DateString(time)
 java.lang.String date2DayOfMonthString(long time)
          Returns the DD portion of a given date Usage: String ENDDD=date2DayOfMonthString();
 java.lang.String date2EllapsedTime(long time, java.util.concurrent.TimeUnit minUnit, boolean shortest)
          Converts a given number of milliseconds, into a number of rl years, months, days, hours, minutes, and seconds.
 java.lang.String date2HRString(long time)
          Returns the Hours portion of a given Time Usage: String ENDHR=date2HRString();
 java.lang.String date2MINString(long time)
          Returns the Minutes portion of a given Time Usage: String ENDMIN=date2MINString();
 java.lang.String date2MonthDateString(long time, boolean shortName)
          Returns the month/day for a given date Usage: String ENDMM=date2MonthDateString();
 java.lang.String date2MonthString(long time, boolean shortName)
          Returns the month for a given date Usage: String ENDMM=date2MonthString(time,true);
 java.lang.String date2SecondsString(long time)
          Converts a given date into a string of form: MM/DD/YYYY HH:MM AP Usage: date2SecondsString(time)
 java.lang.String date2SmartEllapsedTime(long time, boolean shortest)
          Converts a given number of milliseconds, into a number of rl years, months, days, hours, minutes, and seconds.
 java.lang.String date2String(java.util.Calendar C)
          Converts a given date into a string of form: MM/DD/YYYY HH:MM AP Usage: date2String()
 java.lang.String date2String(long time)
          Converts a given date into a string of form: MM/DD/YYYY HH:MM AP Usage: date2String(time)
 java.lang.String date2YYYYString(long time)
          Returns the YYYY portion of a given date Returns the DD portion of a given date Usage: String ENDYYYY=date2YYYYString();
 java.lang.String date2ZoneString(long time)
          Returns the time zone of the server Usage: MEETZN = T2ZoneString();
 java.lang.String getAMPM(java.lang.String TheHour)
          Returns the AMPM stamp given the international Hours portion the Time Usage: getAMPM(GetIn(req, "ENDHR"))
 java.lang.String getMonthName(int monthNum, boolean giveShort)
          Return the name of the month, given a number Usage: String Mnth=getMonthName(m,GiveShort).charStats();
 java.lang.String getTheIntZoneID(int theRawOffset)
          Get the zone id given the timezone string Usage: GetTheZoneID(MeetTZ.getRawOffset())+"\n";
 java.lang.String getTheTimeZone(java.lang.String theID)
          Returns the time zone of the given ID Usage: MEETZN = GetTheTimeZone(ID);
 TimeClock globalClock()
          Returns the mud wide global time clock object as defined by the coffeemud.ini file.
 boolean isTickExpression(java.lang.String val)
          Parses whether a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears
 boolean isValidDateString(java.lang.String dateTimeStr)
          Returns whether the given string would parse to a valid date.
 TimeClock localClock(Physical P)
          Returns the most local clock for the given object.
 java.lang.String month2MM(java.lang.String monthName)
          Returns the numeric representation of the month Usage: month2MM("January");
 int parseTickExpression(java.lang.String val)
          Parses either a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears
 java.lang.String smtpDateFormat(long time)
          format the date for an smtp message Usage: smtpDateFormat(98374987234)
 java.util.Calendar string2Date(java.lang.String dateTimeStr)
          Converts a string of some form into a Calendar object.
 long string2Millis(java.lang.String dateTimeStr)
          Converts a string of some form into a Calendar object.
 java.lang.String twoDigits(long num)
          Converts a number to two digits.
 
Methods inherited from interface com.planet_ink.coffee_mud.Libraries.interfaces.CMLibrary
activate, getServiceClient, L, propertiesLoaded, shutdown
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

MONTHS

static final java.lang.String[] MONTHS
constant for the names of the months in a rl year


SHORTMONTHS

static final java.lang.String[] SHORTMONTHS
constant for the short names of the months in a rl year


MILI_SECOND

static final long MILI_SECOND
constant for the number of milliseconds in a second

See Also:
Constant Field Values

MILI_MINUTE

static final long MILI_MINUTE
constant for the number of milliseconds in a minute

See Also:
Constant Field Values

MILI_HOUR

static final long MILI_HOUR
constant for the number of milliseconds in a rl hour

See Also:
Constant Field Values

MILI_DAY

static final long MILI_DAY
constant for the number of milliseconds in a rl day

See Also:
Constant Field Values

MILI_WEEK

static final long MILI_WEEK
constant for the number of milliseconds in a rl week

See Also:
Constant Field Values

MILI_MONTH

static final long MILI_MONTH
constant for the number of milliseconds in a rl month

See Also:
Constant Field Values

MILI_YEAR

static final long MILI_YEAR
constant for the number of milliseconds in a rl year

See Also:
Constant Field Values
Method Detail

month2MM

java.lang.String month2MM(java.lang.String monthName)
Returns the numeric representation of the month Usage: month2MM("January");

Parameters:
monthName - The month name
Returns:
String The number of the month as a string

getMonthName

java.lang.String getMonthName(int monthNum,
                              boolean giveShort)
Return the name of the month, given a number Usage: String Mnth=getMonthName(m,GiveShort).charStats();

Parameters:
monthNum - Month number to convert
giveShort - Give abbreviation if true
Returns:
String Month name

isValidDateString

boolean isValidDateString(java.lang.String dateTimeStr)
Returns whether the given string would parse to a valid date. If true is returned, the change of getting a valid date from string2Date is much higher.

Parameters:
dateTimeStr - the strong to parse
Returns:
true if its possibly valid, false definitely not

string2Millis

long string2Millis(java.lang.String dateTimeStr)
Converts a string of some form into a Calendar object. Usage: string2Millis(GetRes(Results,"StartDateTime"));

Parameters:
dateTimeStr - The string to retrieve from
Returns:
Calendar Calendar object

string2Date

java.util.Calendar string2Date(java.lang.String dateTimeStr)
Converts a string of some form into a Calendar object. Usage: Calendar.string2Date(GetRes(Results,"StartDateTime"));

Parameters:
dateTimeStr - The string to retrieve from
Returns:
Calendar Calendar object

twoDigits

java.lang.String twoDigits(long num)
Converts a number to two digits.

Parameters:
num - the number
Returns:
the number as two digits

convertHour

java.lang.String convertHour(java.lang.String hours24)
Returns the regular Hours given the hours in the international format (military time) Usage: ConvertHour(GetIn(req, "ENDHR"))

Parameters:
hours24 - Hours in military format
Returns:
String Hours in regular format

getAMPM

java.lang.String getAMPM(java.lang.String TheHour)
Returns the AMPM stamp given the international Hours portion the Time Usage: getAMPM(GetIn(req, "ENDHR"))

Parameters:
TheHour - Hours in military format
Returns:
String AM or PM stamp

getTheIntZoneID

java.lang.String getTheIntZoneID(int theRawOffset)
Get the zone id given the timezone string Usage: GetTheZoneID(MeetTZ.getRawOffset())+"\n";

Parameters:
theRawOffset - The time zone's raw offset to convert
Returns:
String The time zone ID

getTheTimeZone

java.lang.String getTheTimeZone(java.lang.String theID)
Returns the time zone of the given ID Usage: MEETZN = GetTheTimeZone(ID);

Parameters:
theID - The ID of the abbreviated time zone.
Returns:
String The time zone name

date2MonthString

java.lang.String date2MonthString(long time,
                                  boolean shortName)
Returns the month for a given date Usage: String ENDMM=date2MonthString(time,true);

Parameters:
time - The time in miliseconds
shortName - true to use shortened months
Returns:
String The month name

date2BriefString

java.lang.String date2BriefString(long time)
Returns time in HH:MMap format, unless the day is other than today, in which case it prepends yy/m/d. Usage: String ENDMM=date2BriefString(time,true);

Parameters:
time - The time in miliseconds
Returns:
String The date string

date2MonthDateString

java.lang.String date2MonthDateString(long time,
                                      boolean shortName)
Returns the month/day for a given date Usage: String ENDMM=date2MonthDateString();

Parameters:
time - The time in miliseconds
shortName - true to use shortened months
Returns:
String the month/day name

date2APTimeString

java.lang.String date2APTimeString(long time)
Return the time in HH:MM AP format.

Parameters:
time - the time in millis
Returns:
the time in format

date2DayOfMonthString

java.lang.String date2DayOfMonthString(long time)
Returns the DD portion of a given date Usage: String ENDDD=date2DayOfMonthString();

Parameters:
time - The time in miliseconds
Returns:
String The day

date2YYYYString

java.lang.String date2YYYYString(long time)
Returns the YYYY portion of a given date Returns the DD portion of a given date Usage: String ENDYYYY=date2YYYYString();

Parameters:
time - The time in miliseconds
Returns:
String The year

date2HRString

java.lang.String date2HRString(long time)
Returns the Hours portion of a given Time Usage: String ENDHR=date2HRString();

Parameters:
time - time used
Returns:
String The hour

date2MINString

java.lang.String date2MINString(long time)
Returns the Minutes portion of a given Time Usage: String ENDMIN=date2MINString();

Parameters:
time - The time in miliseconds
Returns:
String The minutes

smtpDateFormat

java.lang.String smtpDateFormat(long time)
format the date for an smtp message Usage: smtpDateFormat(98374987234)

Parameters:
time - The time in miliseconds
Returns:
String The minutes

date2ZoneString

java.lang.String date2ZoneString(long time)
Returns the time zone of the server Usage: MEETZN = T2ZoneString();

Parameters:
time - The time in miliseconds
Returns:
String The time zone

date2AMPMString

java.lang.String date2AMPMString(long time)
Returns the Minutes portion of a given Time Usage: String ST_AMPM=date2AMPMString(time);

Parameters:
time - The time in miliseconds
Returns:
String AM or PM stamp

date2String

java.lang.String date2String(java.util.Calendar C)
Converts a given date into a string of form: MM/DD/YYYY HH:MM AP Usage: date2String()

Parameters:
C - The time in calendar
Returns:
String Formatted date/time

date2String

java.lang.String date2String(long time)
Converts a given date into a string of form: MM/DD/YYYY HH:MM AP Usage: date2String(time)

Parameters:
time - The time in miliseconds
Returns:
String Formatted date/time

date2EllapsedTime

java.lang.String date2EllapsedTime(long time,
                                   java.util.concurrent.TimeUnit minUnit,
                                   boolean shortest)
Converts a given number of milliseconds, into a number of rl years, months, days, hours, minutes, and seconds. If in short form, returns y, m, d, h, m, and s. Usage: date2EllapsedTime(time)

Parameters:
time - The time in miliseconds
minUnit - The smallest unit to round down to
shortest - true for short form, false otherwise
Returns:
String Formatted ellapsed time

date2BestShortEllapsedTime

java.lang.String date2BestShortEllapsedTime(long t)
Picks the single best representation of the given ellapsed time, from seconds to minutes to hours to days, and returns the correct amount along with the single letter suffix

Parameters:
t - time in milliseconds
Returns:
ellapsed time approximation.

date2SmartEllapsedTime

java.lang.String date2SmartEllapsedTime(long time,
                                        boolean shortest)
Converts a given number of milliseconds, into a number of rl years, months, days, hours, minutes, and seconds. If in short form, returns y, m, d, h, m, and s. This method will automatically determine the smallest reasonable unit of time to show. Usage: date2SmartEllapsedTime(time)

Parameters:
time - The time in miliseconds
shortest - true for short form, false otherwise
Returns:
String Formatted ellapsed time

date2SecondsString

java.lang.String date2SecondsString(long time)
Converts a given date into a string of form: MM/DD/YYYY HH:MM AP Usage: date2SecondsString(time)

Parameters:
time - The time in miliseconds
Returns:
String Formatted date/time

date2DateString

java.lang.String date2DateString(long time)
Converts a given date into a string of form: MM/DD/YYYY Usage: date2DateString(time)

Parameters:
time - The time in miliseconds
Returns:
String Formatted date

date2Date2String

java.lang.String date2Date2String(long time)
Converts a given date into a string of form: MM/DD/YY Usage: date2Date2String(time)

Parameters:
time - The time in miliseconds
Returns:
String Formatted date

parseTickExpression

int parseTickExpression(java.lang.String val)
Parses either a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears

Parameters:
val - the expression
Returns:
the number of ticks represented by the string

isTickExpression

boolean isTickExpression(java.lang.String val)
Parses whether a tick expression, or an expression ending with the word minutes, hours, seconds, days, mudhours, muddays, mudweeks, mudmonths, or mudyears

Parameters:
val - the expression
Returns:
whether a number of ticks is represented by the string

localClock

TimeClock localClock(Physical P)
Returns the most local clock for the given object.

Parameters:
P - an item, room, mob, whatever.
Returns:
the local clock
See Also:
TimeClock

globalClock

TimeClock globalClock()
Returns the mud wide global time clock object as defined by the coffeemud.ini file.

Returns:
the global clock
See Also:
TimeClock