# psprtc.h File Reference

Go to the source code of this file.

## Data Structures

struct | pspTime

## Enumerations

enum | pspRtcCheckValidErrors { PSP_TIME_INVALID_YEAR = -1, PSP_TIME_INVALID_MONTH = -2, PSP_TIME_INVALID_DAY = -3, PSP_TIME_INVALID_HOUR = -4, PSP_TIME_INVALID_MINUTES = -5, PSP_TIME_INVALID_SECONDS = -6, PSP_TIME_INVALID_MICROSECONDS = -7 }

## Functions

u32 | sceRtcGetTickResolution ()
| Get the resolution of the tick counter.
int | sceRtcGetCurrentTick (u64 *tick)
| Get current tick count.
int | sceRtcGetCurrentClock (pspTime *time, int tz)
| Get current tick count, adjusted for local time zone.
int | sceRtcGetCurrentClockLocalTime (pspTime *time)
| Get current local time into a pspTime struct.
int | sceRtcConvertUtcToLocalTime (const u64 *tickUTC, u64 *tickLocal)
| Convert a UTC-based tickcount into a local time tick count.
int | sceRtcConvertLocalTimeToUTC (const u64 *tickLocal, u64 *tickUTC)
| Convert a local time based tickcount into a UTC-based tick count.
int | sceRtcIsLeapYear (int year)
| Check if a year is a leap year.
int | sceRtcGetDaysInMonth (int year, int month)
| Get number of days in a specific month.
int | sceRtcGetDayOfWeek (int year, int month, int day)
| Get day of the week for a date.
int | sceRtcCheckValid (const pspTime *date)
| Validate pspDate component ranges.
int | sceRtcSetTick (pspTime *date, const u64 *tick)
| Set a pspTime struct based on ticks.
int | sceRtcGetTick (const pspTime *date, u64 *tick)
| Set ticks based on a pspTime struct.
int | sceRtcCompareTick (const u64 *tick1, const u64 *tick2)
| Compare two ticks.
int | sceRtcTickAddTicks (u64 *destTick, const u64 *srcTick, u64 numTicks)
| Add two ticks.
int | sceRtcTickAddMicroseconds (u64 *destTick, const u64 *srcTick, u64 numMS)
| Add an amount of ms to a tick.
int | sceRtcTickAddSeconds (u64 *destTick, const u64 *srcTick, u64 numSecs)
| Add an amount of seconds to a tick.
int | sceRtcTickAddMinutes (u64 *destTick, const u64 *srcTick, u64 numMins)
| Add an amount of minutes to a tick.
int | sceRtcTickAddHours (u64 *destTick, const u64 *srcTick, int numHours)
| Add an amount of hours to a tick.
int | sceRtcTickAddDays (u64 *destTick, const u64 *srcTick, int numDays)
| Add an amount of days to a tick.
int | sceRtcTickAddWeeks (u64 *destTick, const u64 *srcTick, int numWeeks)
| Add an amount of weeks to a tick.
int | sceRtcTickAddMonths (u64 *destTick, const u64 *srcTick, int numMonths)
| Add an amount of months to a tick.
int | sceRtcTickAddYears (u64 *destTick, const u64 *srcTick, int numYears)
| Add an amount of years to a tick.
int | sceRtcSetTime_t (pspTime *date, const time_t time)
int | sceRtcGetTime_t (const pspTime *date, time_t time)
int | sceRtcSetDosTime (pspTime *date, u32 dosTime)
int | sceRtcGetDosTime (pspTime *date, u32 dosTime)
int | sceRtcSetWin32FileTime (pspTime *date, u64 *win32Time)
int | sceRtcGetWin32FileTime (pspTime *date, u64 *win32Time)
int | sceRtcParseDateTime (u64 *destTick, const char *dateString)

## Enumeration Type Documentation

enum pspRtcCheckValidErrors

Enumerator:

  PSP_TIME_INVALID_YEAR |
  PSP_TIME_INVALID_MONTH |
  PSP_TIME_INVALID_DAY |
  PSP_TIME_INVALID_HOUR |
  PSP_TIME_INVALID_MINUTES |
  PSP_TIME_INVALID_SECONDS |
  PSP_TIME_INVALID_MICROSECONDS |

## Function Documentation

int sceRtcCheckValid | ( | const pspTime * | date | ) |

Validate pspDate component ranges.

Parameters:

  | date | - pointer to pspDate struct to be checked

Returns:
  0 on success, one of CheckValidErrors on error

int sceRtcCompareTick | ( | const u64 * | tick1,
|  | const u64 * | tick2
| ) |

Compare two ticks.

Parameters:

  | tick1 | - pointer to first tick
  | tick2 | - poiinter to second tick

Returns:
  0 on equal, <0 when tick1 < tick2, >0 when tick1 > tick2

int sceRtcConvertLocalTimeToUTC | ( | const u64 * | tickLocal,
|  | u64 * | tickUTC
| ) |

Convert a local time based tickcount into a UTC-based tick count.

Parameters:

  | tickLocal | - pointer to u64 tick in local time
  | tickUTC | - pointer to u64 to receive tick in UTC based time

Returns:
  0 on success, < 0 on error

int sceRtcConvertUtcToLocalTime | ( | const u64 * | tickUTC,
|  | u64 * | tickLocal
| ) |

Convert a UTC-based tickcount into a local time tick count.

Parameters:

  | tickUTC | - pointer to u64 tick in UTC time
  | tickLocal | - pointer to u64 to receive tick in local time

Returns:
  0 on success, < 0 on error

int sceRtcGetCurrentClock | ( | pspTime * | time,
|  | int | tz
| ) |

Get current tick count, adjusted for local time zone.

Parameters:

  | time | - pointer to pspTime struct to receive time
  | tz | - time zone to adjust to (minutes from UTC)

Returns:
  0 on success, < 0 on error

int sceRtcGetCurrentClockLocalTime | ( | pspTime * | time | ) |

Get current local time into a pspTime struct.

Parameters:

  | time | - pointer to pspTime struct to receive time

Returns:
  0 on success, < 0 on error

int sceRtcGetCurrentTick | ( | u64 * | tick | ) |

Get current tick count.

Parameters:

  | tick | - pointer to u64 to receive tick count

Returns:
  0 on success, < 0 on error

int sceRtcGetDayOfWeek | ( | int | year,
|  | int | month,
|  | int | day
| ) |

Get day of the week for a date.

Parameters:

  | year | - year in which to check (accounts for leap year)
  | month | - month that day is in
  | day | - day to get day of week for

Returns:
  day of week with 0 representing Monday

int sceRtcGetDaysInMonth | ( | int | year,
|  | int | month
| ) |

Get number of days in a specific month.

Parameters:

  | year | - year in which to check (accounts for leap year)
  | month | - month to get number of days for

Returns:
  # of days in month, <0 on error (?)

int sceRtcGetDosTime | ( | pspTime * | date,
|  | u32 | dosTime
| ) |

int sceRtcGetTick | ( | const pspTime * | date,
|  | u64 * | tick
| ) |

Set ticks based on a pspTime struct.

Parameters:

  | date | - pointer to pspTime to convert
  | tick | - pointer to tick to set

Returns:
  0 on success, < 0 on error

u32 sceRtcGetTickResolution | ( |  | ) |

Get the resolution of the tick counter.

Returns:
  # of ticks per second

int sceRtcGetTime_t | ( | const pspTime * | date,
|  | time_t | time
| ) |

int sceRtcGetWin32FileTime | ( | pspTime * | date,
|  | u64 * | win32Time
| ) |

int sceRtcIsLeapYear | ( | int | year | ) |

Check if a year is a leap year.

Parameters:

  | year | - year to check if is a leap year

Returns:
  1 on leapyear, 0 if not

int sceRtcParseDateTime | ( | u64 * | destTick,
|  | const char * | dateString
| ) |

int sceRtcSetDosTime | ( | pspTime * | date,
|  | u32 | dosTime
| ) |

int sceRtcSetTick | ( | pspTime * | date,
|  | const u64 * | tick
| ) |

Set a pspTime struct based on ticks.

Parameters:

  | date | - pointer to pspTime struct to set
  | tick | - pointer to ticks to convert

Returns:
  0 on success, < 0 on error

int sceRtcSetTime_t | ( | pspTime * | date,
|  | const time_t | time
| ) |

int sceRtcSetWin32FileTime | ( | pspTime * | date,
|  | u64 * | win32Time
| ) |

int sceRtcTickAddDays | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | int | numDays
| ) |

Add an amount of days to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numDays | - number of days to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddHours | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | int | numHours
| ) |

Add an amount of hours to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numHours | - number of hours to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddMicroseconds | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | u64 | numMS
| ) |

Add an amount of ms to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numMS | - number of ms to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddMinutes | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | u64 | numMins
| ) |

Add an amount of minutes to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numMins | - number of minutes to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddMonths | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | int | numMonths
| ) |

Add an amount of months to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numMonths | - number of months to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddSeconds | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | u64 | numSecs
| ) |

Add an amount of seconds to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numSecs | - number of seconds to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddTicks | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | u64 | numTicks
| ) |

Add two ticks.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numTicks | - number of ticks to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddWeeks | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | int | numWeeks
| ) |

Add an amount of weeks to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numWeeks | - number of weeks to add

Returns:
  0 on success, <0 on error

int sceRtcTickAddYears | ( | u64 * | destTick,
|  | const u64 * | srcTick,
|  | int | numYears
| ) |

Add an amount of years to a tick.

Parameters:

  | destTick | - pointer to tick to hold result
  | srcTick | - pointer to source tick
  | numYears | - number of years to add

Returns:
  0 on success, <0 on error