GetTimeHour()

From NWN Lexicon
Jump to navigationJump to search

Gets the current hour.

int GetTimeHour();

Description

Returns the current hour as an integer between 0 and 23.


Remarks

There may be only 1 or 2 minutes in an hour, see HoursToSeconds.

For getting the real server time you can use sqlquery eg:

SqlPrepareQueryObject(GetModule(), "SELECT STRFTIME(@fmt, 'now', 'localtime')")


Example

void main()
{
    int nHour = GetTimeHour();
    if (nHour != GetLocalInt(OBJECT_SELF, "nLastHour"))
    {
        SpeakString("Hour is: " + IntToString(nHour));
        SetLocalInt(OBJECT_SELF, "nLastHour", nHour);
    }
    return;
}

See Also

functions: 

HoursToSeconds SetTime GetTimeMinute GetTimeSecond GetTimeMillisecond



 author: Charles Feduke, additional contributor(s): Dana C., Michael Janicki