PSP2SDK  dirty-f9e4f2d
The free SDK for PSP2
include/psp2/rtc.h
Go to the documentation of this file.
00001 
00012 #ifndef _PSP2_RTC_H_
00013 #define _PSP2_RTC_H_
00014 
00015 #include <psp2/types.h>
00016 #include <time.h>
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 /* struct/union */
00023 
00024 typedef struct SceRtcTime {
00025     unsigned short year;
00026     unsigned short month;
00027     unsigned short day;
00028     unsigned short hour;
00029     unsigned short minutes;
00030     unsigned short seconds;
00031     unsigned int microseconds;
00032 } SceRtcTime;
00033 
00034 typedef enum SceRtcCheckValidError {
00035     SCE_RTC_INVALID_YEAR    = -1,
00036     SCE_RTC_INVALID_MONTH   = -2,
00037     SCE_RTC_INVALID_DAY = -3,
00038     SCE_RTC_INVALID_HOUR    = -4,
00039     SCE_RTC_INVALID_MINUTES = -5,
00040     SCE_RTC_INVALID_SECONDS = -6,
00041     SCE_RTC_INVALID_MICROSECONDS    = -7
00042 } SceRtcCheckValidError;
00043 
00044 /* prototypes */
00045 
00046 unsigned int sceRtcGetTickResolution();
00047 int sceRtcGetCurrentTick(uint64_t *tick);
00048 int sceRtcGetCurrentClock(SceRtcTime *time, int tz);
00049 int sceRtcGetCurrentClockLocalTime(SceRtcTime *time);
00050 
00051 int sceRtcConvertUtcToLocalTime(const uint64_t *tickUTC, uint64_t *tickLocal);
00052 int sceRtcConvertLocalTimeToUTC(const uint64_t *tickLocal, uint64_t *tickUTC);
00053 
00054 int sceRtcIsLeapYear(int year);
00055 
00056 int sceRtcGetDaysInMonth(int year, int month);
00057 int sceRtcGetDayOfWeek(int year, int month, int day);
00058 
00059 int sceRtcCheckValid(const SceRtcTime *date);
00060 
00061 int sceRtcSetTick(SceRtcTime *date, const uint64_t *tick);
00062 int sceRtcGetTick(const SceRtcTime *date, uint64_t *tick);
00063 int sceRtcCompareTick(const uint64_t *tick1, const uint64_t *tick2);
00064 
00065 int sceRtcTickAddTicks(uint64_t *destTick, const uint64_t *srcTick, uint64_t numTicks);
00066 int sceRtcTickAddMicroseconds(uint64_t *destTick, const uint64_t *srcTick, uint64_t numMS);
00067 int sceRtcTickAddSeconds(uint64_t *destTick, const uint64_t *srcTick, uint64_t numSecs);
00068 int sceRtcTickAddMinutes(uint64_t *destTick, const uint64_t *srcTick, uint64_t numMins);
00069 int sceRtcTickAddHours(uint64_t *destTick, const uint64_t *srcTick, int numHours);
00070 int sceRtcTickAddDays(uint64_t *destTick, const uint64_t *srcTick, int numDays);
00071 int sceRtcTickAddWeeks(uint64_t *destTick, const uint64_t *srcTick, int numWeeks);
00072 int sceRtcTickAddMonths(uint64_t *destTick, const uint64_t *srcTick, int numMonths);
00073 int sceRtcTickAddYears(uint64_t *destTick, const uint64_t *srcTick, int numYears);
00074 
00075 int sceRtcSetTime_t(SceRtcTime *date, const time_t time);
00076 int sceRtcGetTime_t(const SceRtcTime *date, time_t *time);
00077 int sceRtcSetDosTime(SceRtcTime *date, unsigned int dosTime);
00078 int sceRtcGetDosTime(SceRtcTime *date, unsigned int dosTime);
00079 int sceRtcSetWin32FileTime(SceRtcTime *date, uint64_t *win32Time);
00080 int sceRtcGetWin32FileTime(SceRtcTime *date, uint64_t *win32Time);
00081 
00082 int sceRtcParseDateTime(uint64_t *destTick, const char *dateString);
00083 int sceRtcFormatRFC2822(char *pszDateTime, const uint64_t *pUtc, int iTimeZoneMinutes);
00084 int sceRtcFormatRFC2822LocalTime(char *pszDateTime, const uint64_t *pUtc);
00085 int sceRtcFormatRFC3339(char *pszDateTime, const uint64_t *pUtc, int iTimeZoneMinutes);
00086 int sceRtcFormatRFC3339LocalTime(char *pszDateTime, const uint64_t *pUtc);
00087 int sceRtcParseRFC3339(uint64_t *pUtc, const char *pszDateTime);
00088 
00089 /* missing prototypes */
00090 
00091 // sceRtcGetLastAdjustedTick
00092 // sceRtcSetTime64_t
00093 // sceRtcGetLastReincarnatedTick
00094 // sceRtcGetDayOfYear
00095 // sceRtcGetTime64_t
00096 // sceRtcGetCurrentNetworkTick
00097 
00098 #ifdef __cplusplus
00099 }
00100 #endif
00101 
00102 #endif /* _PSP2_RTC_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines