The Pandora And Time.


Bosbeetle

Terminally lost
Joined
Sep 7, 2008
Messages
4,282
Age
43
Location
The Netherlands
Website
Visit site
I am running HF4 on my pandora, in this hotfix timezone stuff was fixed. And indeed it works both in my panel (right bottem) and in the terminal after checking date.

Code:
bosbeetle-openpandora:~/Desktop$ date
Mon Oct  4 20:13:40 GMT+2 2010

So far everything works out. But now where something gets lost. I happen to be fond of scrobbling :)P) and I tried it on most players vailable. Scrobbling goes fine but a wrong time gets appended. But in a different way.

OMMPC - 2 hours ahead of time
Audacious - 4 hours ahead of time
Deadbeef - 4 hours ahead of time

So the two hours could probably be because of the GMT+2 timezone but how could the pandora get 4 hours ahead. And more importantly does somebody have any idea how to fix this.
 
Can developers of any of these three programms tell me where the scrobbles get their time? So I can do a bit of research?

looking in the code of mpdscribble I can find this

Code:
as_timestamp (void)
{
  /* create timestamp for 1.1 protocol. */
  time_t t;
  char *utc = malloc (MAX_TIMESTAMP_SIZE);
  if (!utc)
    exit (ENOMEM);

  t = time (NULL);
  strftime (utc, MAX_TIMESTAMP_SIZE, "%Y-%m-%d %H:%M:%S", gmtime (&t));

  return utc;
}

I think the strftime gives the time in a string that is sent to the scrobbler

strftime(string,maxlen,format,timestruct)
"strftime" converts information from a time structure to a string form, and writes the string into the memory area pointed to by "string"

here is a reference about gmtime http://www.cplusplus.com/reference/clibrary/ctime/gmtime/ and how to get correct values I have no Idea what is happening on the pandora but maybe this helps? You can also use localtime I dont know how C gets the time and how the pandora deals with it. But I think that this may be causing the differences in the scrobblers.
 
ok forget that i just figured out that if i want the time to be correct in utc and local time (checked with date -u amnd date) i have to set the pandora to gmt-2 however i am at gmt+2.
 
Bosbeetle said:
ok forget that i just figured out that if i want the time to be correct in utc and local time (checked with date -u amnd date) i have to set the pandora to gmt-2 however i am at gmt+2.
Thanks for this, Bosbeetle.
you rock :)
So I followed this.
in detail :
  1. update /etc/timezone
  2. mv /etc/localtime /etc/localtime-old
  3. ln -sf /usr/share/zoneinfo/America/Toronto /etc/localtime
  4. reboot
Done :)
 
Last edited by a moderator:
for me it works however its weird

bosbeetle-openpandora:~/Desktop$ date
Tue Oct 5 19:15:26 GMT-2 2010
bosbeetle-openpandora:~/Desktop$ date -u
Tue Oct 5 17:15:28 UTC 2010

You see here the times according to GMT+2 but it is called GMT-2 on the pandora.

sebt3 what you do is the same as the pandora does but somehow /usr/share/zoneinfo/Etc/GMT+2 seems to give values for GMT-2 and vice versa :p

But my scrobbling is in time now :D
 
So for everybody who wants correct time in scrobbling this is the solution

Check your UTC time in terminal by doing 'date -u' you can put it to the right time in UTC http://www.worldtimeserver.com/current_time_in_UTC.aspx by doing 'sudo date - u MMDDhhmmYYYY' and now you should find timezone that gives you the correct time (in settings -> date and time).

Or do it the sebt3 way (but I am not sure if that update zoneinfo changes the timezones to be correct)
 
Hmm, I didn't realize HF4 actually gave us the full /usr/share/zoneinfo folder... Previous to HF4 I had copied that info over manually and scrobbling worked when setting the timezone as sebt describes...

Unfortunately setting it correctly now breaks my change to mpdscribble. But as your Bosbeetles results show, that wasn't really working anyway...I think it just happen to work out for my timezone... Anyway, I'm going to do some playing around with this later tonight and see what I can come up with...at least in regards to where mpdscribble is getting the time from...
 
something just jogged in my memory. I seem to recall that when I set the timezone and time for the first time, it was somehow wrong. I can't remember the details anymore, it seems so long ago (two months now?) but it was something like: the clock in the lower right showed the right time, but "date" and "date -u" were somehow wrong. I think maybe "date" also showed the correct time but it was UTC, and date -u showed... no...
At any rate, I fixed it by linking /etc/localtime to America/New_York instead of GMT-5 and then setting the time again. The GMT* timezones are not actually meant to be used, if I recall correctly. You're supposed to use the actual region/zone name.
 
OH! That's right. The display clock is doing it wrong (by extension of the GMT* timezones being wrong). I always meant to file a bug report for it. It displays the opposite from your actual time. ie, if you set GMT-5, it actually displays as if you had selected GMT+5.
The GMT* timezones "correct" for this, which is why the clock can match "date", but "date -u" returns the wrong UTC. If you set to a proper timezone (as opposed to the GMT* ones) then the date and date -u are correct, but now your clock is wrong.

edit: forgot the "reboot" part. So set the correct timezone, set the correct time, reboot. Right. Don't use the GMT* timezones, they're broken. I'll file a bug report.
 
Linux and timezones... always a challenge if you don't know exactly what you are doing.

So a fix is selecting the country and not using the GMT - values?
If that fixes it, I'm gonna update the scripts.
 
Cool :) it would feel nice if I can go back to europe, now I am in the atlantic ocean timezone wise :D

btw I think

http://bugs.openpandora.org/index.php?do=details&task_id=188&project=1&order=id&sort=desc&order2=progress&sort2=desc&pagenum=1
http://bugs.openpandora.org/index.php?do=details&task_id=187&project=1&order=id&sort=desc&order2=progress&sort2=desc&pagenum=1

Are related to the same problem. The screen turning off has to do with the 'screensaver' that was introduced in HF4
 
On all boxes with zoneinfo support (that's most *nix except IRIX and some other sysv-based ones) I always do:

cd /etc
rm localtime
ln -s /usr/share/zoneinfo/MET localtime

and all's fine. Change MET to whatever is your right local timezeone.
 
EvilDragon said:
Linux and timezones... always a challenge if you don't know exactly what you are doing.

So a fix is selecting the country and not using the GMT - values?
If that fixes it, I'm gonna update the scripts.

Yep, I believe that will do it ED. After making the change and getting the date/time set correctly the date command and desktop are still reporting the correct time, and both Audacious and an unmodified mpdscribble are able to scrobble with the correct time according my testing. Confirmation from someone else that it's all working correctly(including the scrobbling) would be nice as I've been know to be completely and totally wrong before. :)
 
Last edited by a moderator:
Back
Top