Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Time Zone

                  
   
  1. #1
    PSP Coder
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    0

    Default Time Zone

    Here's how to get the time zone the PSP is set to in the XMB.
    you shouldn't need it as a setting in the configuration file.
    sceRtcGetCurrentClockLocalTime(&rtime); // calculate timezone
    hhr = rtime.hour;
    lochr = hhr;
    sceRtcGetCurrentClock(&rtime,0);
    utchour = rtime.hour;
    utchr = utchour;
    intz = lochr - utchr;

    if (intz == -12) {intz = 12;}
    if (intz == -13) {intz = 11;}
    if (intz == -14) {intz = 10;}
    if (intz == -15) {intz = 9;}
    if (intz == -16) {intz = 8;}
    if (intz == -17) {intz = 7;}
    if (intz == -18) {intz = 6;}
    if (intz == -19) {intz = 5;}
    if (intz == -20) {intz = 4;}
    if (intz == -21) {intz = 3;}
    if (intz == -22) {intz = 2;}
    if (intz == -23) {intz = 1;}
    if (intz == -24) {intz = 0;}
    Art.

  2. #2

    Default

    This refers to getting the time for MapThis! from the PSP's XMB or what?

  3. #3
    PSP Coder
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    0

    Default

    If Deniska wanted to, or anyone since the source is available I suppose,
    the routine can be insterted to get the timezone the same way as my clock program.

    The PSP knows the time and the timezone, the date and many other things,
    so there's no need to get the user to define it in a config file.

    Not a complaint, it's a picky thing really, but an easy fix.

  4. #4
    DCEmu Pro
    Join Date
    Feb 2007
    Location
    Netherlands
    Posts
    539
    Rep Power
    65

    Default

    Instead of using all those if-statements, you could also use this:
    intz = (intz+24)%24;

  5. #5
    PSP Coder
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    0

    Default

    What does it do exactly?
    It causes an error if I compile it because the % sign defines 24 as binary
    which the numbers 2 and 4 are invalid input for.

    I got it down to this:
    tzc = 12;
    tzd = 12;

    sceRtcGetCurrentClockLocalTime(&rtime); // calculate timezone
    hhr = rtime.hour;
    lochr = hhr;
    sceRtcGetCurrentClock(&rtime,0);
    utchour = rtime.hour;
    utchr = utchour;
    intz = lochr - utchr;

    for (tzc=12; tzc<24; tzc++) {
    if (intz == -tzc) {intz = tzd;}
    tzd--;
    } // tzc
    Which is smaller space, but worse instruction time.
    Art.

  6. #6
    PSP Coder deniska's Avatar
    Join Date
    Jul 2005
    Posts
    1,557
    Rep Power
    76

    Default

    how would I go about time in India? ;-)
    they have their own timezone with 30 min diffrence from everyone else...

  7. #7
    PSP Coder
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    0

    Default

    Change config file to:
    Are you in India? Y/N

  8. #8
    DCEmu Newbie
    Join Date
    Aug 2006
    Posts
    12
    Rep Power
    0

    Default

    A 30 minute time difference wouldn't matter because the user already changed their time to adjust for the 30 minute difference in the psp.

  9. #9
    PSP Coder
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    0

    Default

    It could still be worked out, yes, but deniska was looking at
    a bug in my routine that uses integers, so it would
    only give a result to the nearest hour, and be incorrect for India.
    Is fixable though.

  10. #10
    PSP Coder deniska's Avatar
    Join Date
    Jul 2005
    Posts
    1,557
    Rep Power
    76

    Default

    Quote Originally Posted by Arxidon View Post
    A 30 minute time difference wouldn't matter because the user already changed their time to adjust for the 30 minute difference in the psp.
    it would matter for mapThis! because it uses gmt time from gps and timezone offset to display correct "gps" time...

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •