Definitions: | Time-related values in the console | |
---|---|---|
Name | Value | Description |
frames_per_second | 60 | Frame rate used by the console. Used for the screen and other functions too |
frame_time | 1/60 | Duration of a frame, in seconds |
Function: | get_cycle_counter |
---|---|
Prototype: | int get_cycle_counter() |
Description: | Obtains the current value of the cycle counter, which measures the number of CPU cycles elapsed in the current frame |
Returns: | |
int | Contents of the cycle counter |
Function: | get_frame_counter |
---|---|
Prototype: | int get_frame_counter() |
Description: | Obtains the current value of the frame counter, which measures the number of frames elapsed since the last console power-on or reset |
Returns: | |
int | Contents of the frame counter |
Function: | get_date |
---|---|
Prototype: | int get_date() |
Description: | Obtains the current date, given in the console's internal representation |
Returns: | |
int | Current date compressed into a single integer |
Function: | get_time |
---|---|
Prototype: | int get_time() |
Description: | Obtains the current time, given in the console's internal representation |
Returns: | |
int | Current time compressed into a single integer |
Structure: | date_info |
---|---|
Description: | Structure holding a date in the common human format |
Fields: | |
int year | The year AD. Years BC are not supported |
int month | Month within the year. Given from 1 (January) to 12 (December) |
int day | Day within the month, Starting from 1 |
Structure: | time_info |
---|---|
Description: | Structure holding a time within the day (from 00:00:00) in the common human format |
Fields: | |
int hours | Hours within the day (from 0 to 23) |
int minutes | Minutes within the hour (from 0 to 59) |
int seconds | Seconds within the minute (from 0 to 59) |
Function: | translate_date |
---|---|
Prototype: | void translate_date( int date, date_info* translated ) |
Description: | Translates a date value from console's internal representation to a structured format |
Arguments: | |
int date | Date to translate, in internal format |
date_info* translated | Pointer to the structure that will receive the translated date |
Function: | translate_time |
---|---|
Prototype: | void translate_time( int time, time_info* translated ) |
Description: | Translates a time value from console's internal representation to a structured format |
Arguments: | |
int time | Time to translate, in internal format |
time_info* translated | Pointer to the structure that will receive the translated time |
Function: | end_frame |
---|---|
Prototype: | void end_frame() |
Description: | Waits until the beginning of the next frame. When execution continues the screen will have been refreshed, and the states of gamepads will have been updated |
Function: | sleep |
---|---|
Prototype: | void sleep( int frames ) |
Description: | Pauses program execution for the given number of frames (1 second = 60 frames) |
Arguments: | |
int frames | Number of frames to pause |