Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 31
Registered: ‎12-25-2010
My Device: PlayBook
My Carrier: Rogers

Set date/time in Simulator

Does anyone know of a way to set the time in the Simulator? My simulator always seems to be 4 hours behind. Maybe its related to my timezone, which is Eastern (GMT - 4).

 

I was able to figure out (accidentally) that the date in the Simulator is based on whatever date your OS has. I had my OS (Windows 7 in my case) date set 1 day in advance by mistake and saw that the last modified time stamps on files I was creating in my PlayBook app were one day in advance too.

 

However, I haven't found any way to change the time, which is always wrong in my case. Does anyone else have this time shift problem?

 

My app syncs files on the Playbook to a remote server, so having the correct last modification date for files is kind of important Smiley Happy I could do some workaround where I manually adjust the hours in my code and remove it for the production version. But I was wondering if anyone has other ideas?

 

Thanks!

_________________
My apps: PlayText
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Set date/time in Simulator

hey alinium,

 

currently there is no "official" way to change the time on the simulator. however if someone were to find a prefence file in the system that stored the timezone then it'd be most likely be possible to edit that file and fix the clock. but until then your best bet is to use the workaround you mentioned.

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Set date/time in Simulator

 


alinium wrote:

Does anyone know of a way to set the time in the Simulator? My simulator always seems to be 4 hours behind. Maybe its related to my timezone, which is Eastern (GMT - 4).

 

However, I haven't found any way to change the time, which is always wrong in my case. Does anyone else have this time shift problem?

 

I do, and I believe most people would have the problem, but I've found several workarounds.

 

The simplest so far is to telnet into the device as the root user, using the same thing as password, and type "rtc -l hw".  This tells QNX that the "hardware" clock (i.e. what it gets from the virtual machine) is in local time.  Check the date before and after with the "date" command... it should show the change immediately.  The on-screen clock will change the next time it advances the minutes.

 

I don't know for sure whether this will fix the issue for anyone outside of Eastern time as, at least on my unit, the timezone for the device is EDT.  On the other hand, that's also the timezone for Waterloo, so maybe RIM hardcoded it in the image for now.

 

An alternative is simply to adjust the time with the date command.  Just enter "date HHMM" and it should update immediately (again, the screen may lag).  Type "use date" to get help for other options.

 

This is also not a persistent change.  It sounds like you would benefit from a persistent change here, so try this instead, though not that it's both undocumented and not even necessarily correct, but it works here.

 

Again, using telnet, type "echo _CS_TIMEZONE::utc>>/pps/services/confstr/_CS_TIMEZONE" without the quotation marks.  It's probably a good idea to record the original setting first, so "cat /pps/services/confstr/_CS_TIMEZONE" and copy/paste the result somewhere if you wish.  Doing both this and the other changes may not give sensible results so don't blame me if you void the warranty on your simulator and have to rebuild it. Smiley Happy

 

That will tell your simulator that it's using UTC instead of the default (which at least here and presumably for you is EDT04.  Here it results in the output of "date" changing immediately to show UTC, which makes the onscreen display read the correct wall-clock time when it next updates.  Obviously we're not really in UTC, so this is fudging things.  If you are making use of the timezone information in your app, I expect this one won't give you quite the results you need, unless for some reason this doesn't affect what ActionScript sees for the Date object.

 

I don't think there's a way to make a correct change (e.g. with "rtc -l hw") persistent yet as we don't really have a hardware clock, just the fake one that is presumably set up by VMWare when it launches -- and that appears to reset each time back to your own machine's time.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
New Developer
Posts: 18
Registered: ‎12-29-2010
My Device: Torch 9800
My Carrier: Telus

Re: Set date/time in Simulator

Hey,

 

I am in the Atlantic time and I can confirm that the simulator is set to Eastern time by default. But I did some playing around and looking through QNX Developer documentation and found that you can set the timezone like:

 

 

# echo _CS_TIMEZONE::AST4ADT >> /pps/services/confstr/_CS_TIMEZONE
# rtc -l hw

 

 

Then you can see the current date in the local timezone and utc

 

 

# date
Sat Jan 08 15:25:27 AST 2011
# date -u
Sat Jan 08 19:25:28 UTC 2011

 

For information on other timezone formats see:

 

http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/user_guide/environment.html#TimeZone

New Developer
Posts: 5
Registered: ‎01-04-2011
My Device: Not Specified

Re: Set date/time in Simulator

Maybe a silly question, but what is the VMWare - BB PlayBook login/password?  I tried everything I could think of and searched the Web, but there's not much out there for playbook atm =).

New Developer
Posts: 18
Registered: ‎12-29-2010
My Device: Torch 9800
My Carrier: Telus

Re: Set date/time in Simulator

it is root/root

 

I haven't seen it documented anywhere either.. just figured it out from some posts on here Smiley Wink

Trusted Contributor
Posts: 108
Registered: ‎12-28-2010
My Device: Free PlayBook
My Carrier: Verizon

Re: Set date/time in Simulator

Scroll up and see Peter's post.