(plugin) sceRtcGetCurrentClockLocalTime problem

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Slash
Posts: 26
Joined: Sun Jan 07, 2007 9:04 pm

(plugin) sceRtcGetCurrentClockLocalTime problem

Post by Slash »

I have a code in my program...

Code: Select all

pspTime cTime;
int errCode = sceRtcGetCurrentClockLocalTime(&cTime);
which works perfectly as an EBOOT.PBP. But when I've tried it as a plugin, it does not work. If I remove that code, the plugin works fine. Could it be that the rtc module is not yet loaded when the plugins run? What can I do to run it as soon as the PSP starts (vsh plugin)?

Update: It seems that other rtc.prx functions does not work too. If the said rtc function is removed, the plugin works perfect, but if added, succeeding plugin process is not working as if the plugin was terminated prematurely. I've tried to load and start rtc.prx module manually and still rtc functions does not work properly. :(
kururin
Posts: 36
Joined: Wed Jul 05, 2006 7:19 am

Post by kururin »

Your problem is very simple.
You are using the rtc library, which is an user mode library, and in 3.XX kernel modules cannot use user functions.

The solution is to change this in the makefile:

from:
-lpsprtc

to:
-lpsprtc_driver
Slash
Posts: 26
Joined: Sun Jan 07, 2007 9:04 pm

Post by Slash »

kururin wrote:Your problem is very simple.
You are using the rtc library, which is an user mode library, and in 3.XX kernel modules cannot use user functions.

The solution is to change this in the makefile:

from:
-lpsprtc

to:
-lpsprtc_driver
Thanks a lot! I love you! Lol. :D

EDIT: One problem though, the timezone does not work. The date/time given is the time with the timezone of 0.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

http://forums.ps2dev.org/viewtopic.php? ... t=timezone

Shine shows you haow to get timezone from sysparams,
and adjust it yourself.
Slash
Posts: 26
Joined: Sun Jan 07, 2007 9:04 pm

Post by Slash »

Art wrote:http://forums.ps2dev.org/viewtopic.php? ... t=timezone

Shine shows you haow to get timezone from sysparams,
and adjust it yourself.
Thanks alot but I'm having a trouble compiling it. The program compiles fine but if I add the tzset(), it gives me an error...

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(_sbrk.o): In function `_sbrk':../../../../../../newlib/libc/sys/psp/libcglue.c:524: undefined reference to `sceKernelMaxFreeMemSize'
collect2: ld returned 1 exit status
make: *** [timezone_sampler.elf] Error 1
Makefile:

Code: Select all

TARGET = timezone_sampler
OBJS = main.o exports.o

BUILD_PRX = 1

USE_KERNEL_LIBS = 1

PRX_EXPORTS = exports.exp

CFLAGS = -O2 -G0 -Wall
ASFLAGS = $(CFLAGS)

LIBS = -lpspkernel -lpsprtc_driver -lpsplibc -lpsputility
LDFLAGS = -nostartfiles

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Include files:

Code: Select all

#include <pspkernel.h>
#include <psprtc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
Post Reply