Voffcon NodeMcu device server
 All Classes Functions
GTime Class Reference

Used to store time. Depended on which constuctor is used, values can be eather a "date and time" or a "counter" up to 49 days. More...

Public Member Functions

 GTime (const GTime &gTime)
 
 GTime (unsigned long milliSeconds)
 Constructor for the GTime object Creates new GTime by converting milliseconds to GTime Largest possible unsigned long is 4294967295, which is 49 days, 17:02:47 If there are more than 28 days then the month is not be increased so days can grow up to 49 But note, this is not a real GTime because this is more like a counter, so if milliseconds are less than one day year, month and day will all be 0 More...
 
void setTime (unsigned long milliSeconds)
 Sets a new GTime by converting milliseconds to GTime Largest possible unsigned long is 4294967295, which is 49 days, 17:02:47 If there are more than 28 days then the month is not be increased so days can grow up to 49 But note, this is not a real GTime because this is more like a counter, so if milliseconds are less than one day year, month and day will all be 0 More...
 
boolean setTime (String strTime)
 Sets time values from a given string More...
 
int strToMonth (String month)
 Converts a 3 letter english month name to the number of the month in the year. More...
 
String toString ()
 Returns date and time values as a english date time string. More...
 
String toStreng ()
 Returns date and time values as a icelandic date time string. More...
 
String toJson ()
 Returns the date and time values as an JSON object. More...
 
int getYear ()
 Get the year part of the GTime More...
 
int getMonth ()
 Get the month part of the GTime More...
 
int getDay ()
 Get the day part of the GTime More...
 
int getHours ()
 Get the hours part of the GTime More...
 
int getMinutes ()
 Get the minutes part of the GTime More...
 
int getSeconds ()
 Get the seconds part of the GTime More...
 

Static Public Member Functions

static int toNumber (String str)
 Converts a String to a number positive number. Negative numbers are considered invalid. More...
 

Detailed Description

Used to store time. Depended on which constuctor is used, values can be eather a "date and time" or a "counter" up to 49 days.

Constructor & Destructor Documentation

GTime::GTime ( const GTime gTime)

Assignment constructor

1 GTime x, y;
2 x = y;
GTime::GTime ( unsigned long  milliSeconds)

Constructor for the GTime object Creates new GTime by converting milliseconds to GTime Largest possible unsigned long is 4294967295, which is 49 days, 17:02:47 If there are more than 28 days then the month is not be increased so days can grow up to 49 But note, this is not a real GTime because this is more like a counter, so if milliseconds are less than one day year, month and day will all be 0

Parameters
milliSecondsThere are 1000 milliSeconds in a second

Member Function Documentation

int GTime::getDay ( )

Get the day part of the GTime

Returns
The day as a integer number
int GTime::getHours ( )

Get the hours part of the GTime

Returns
The hours as a integer number
int GTime::getMinutes ( )

Get the minutes part of the GTime

Returns
The minutes as a integer number
int GTime::getMonth ( )

Get the month part of the GTime

Returns
The month as a integer number
int GTime::getSeconds ( )

Get the seconds part of the GTime

Returns
The seconds as a integer number
int GTime::getYear ( )

Get the year part of the GTime

Returns
The year as a integer number
void GTime::setTime ( unsigned long  milliSeconds)

Sets a new GTime by converting milliseconds to GTime Largest possible unsigned long is 4294967295, which is 49 days, 17:02:47 If there are more than 28 days then the month is not be increased so days can grow up to 49 But note, this is not a real GTime because this is more like a counter, so if milliseconds are less than one day year, month and day will all be 0

Parameters
milliSecondsThere are 1000 milliSeconds in a second
boolean GTime::setTime ( String  strTime)

Sets time values from a given string

Parameters
strTimeA string with date and time. The string needs to be formatted like this: Fri, 15 Jul 2016 11:08:12 GMT
Returns
Success: returns true if time was set successfully. Fail: returns false.
int GTime::strToMonth ( String  month)

Converts a 3 letter english month name to the number of the month in the year.

Parameters
monthA string of length 3, which represents the month. For example "JAN" for january.
Returns
success : the number of the month, where 1 is january. fail : -1
String GTime::toJson ( )

Returns the date and time values as an JSON object.

Returns
A String formatted as an JSON object
int GTime::toNumber ( String  str)
static

Converts a String to a number positive number. Negative numbers are considered invalid.

Parameters
strThe string to be converted to a number.
Returns
Success: The converted number. Fail : -9999
String GTime::toStreng ( )

Returns date and time values as a icelandic date time string.

Returns
Date and time string on the format "DD.MM.YY hh:mm:ss"
String GTime::toString ( )

Returns date and time values as a english date time string.

Returns
Date and time string on the format "MM/DD/YY hh:mm:ss"

The documentation for this class was generated from the following file: