all groups > dotnet compact framework > december 2007 >
You're in the

dotnet compact framework

group:

ERROR WHEN SETTING DATE


Re: ERROR WHEN SETTING DATE ctacke/
12/31/2007 12:41:48 PM
dotnet compact framework: How are you reading the date? DateTime.Now?


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


[quoted text, click to view]

Re: ERROR WHEN SETTING DATE ctacke/
12/31/2007 1:23:07 PM
It sounds like it's a timezone issue. The CF caches the current DateTime
(at least in 1.0 it did), so if you call out to set the time, DateTime.Now
will always be wrong from that point on. Without seeing code, I can't say
for sure what might be goping wrong though.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



[quoted text, click to view]

ERROR WHEN SETTING DATE tony
12/31/2007 8:14:18 PM
HI,

strange bug from device that work for 6 month ..
everytime the device is starting, the user set the date and time.

today, the user set 31/12/2007 14:00 and in the main menu
the date was 01/01/2008 .

what am i missing here ?

the device is not connected to internet or any network.
and im using OpenNETCF.Win32.DateTimeEx.SetLocalTime. and net compact 1.0

thanking in advance.

Re: ERROR WHEN SETTING DATE tony
12/31/2007 8:52:03 PM
Hi,

till now i used DateTime.Now , after reading a little , i tried also
GetLocalTime
but it return the same wrong value of 1/1/2008.

very annoying.

any ideas ?

thanks for your help.


[quoted text, click to view]

Re: ERROR WHEN SETTING DATE tony
12/31/2007 9:31:08 PM
except from SetLocalTime and GetLocalTime

i need to call other functions ?

how do i set the timezone, and to what value ?

i can build small program to test it and send the code, just tell me what to
test ? (SetLocalTime, GetLocalTime,DateTime.Now)

thanking in advance.


[quoted text, click to view]

Re: ERROR WHEN SETTING DATE Paul G. Tobey [eMVP]
1/2/2008 8:48:44 AM
SetTimezoneInformation() will set the time zone (OpenNETCF has a wrapper for
this, too). Check what the Control Panel Date/Time applet says about the
time zone. Have you tried setting the date/time *that* way and seeing if it
works? That would point more-definitely to either a) your code is wrong, or
b) there is a time zone issue.

Paul T.

[quoted text, click to view]

Re: ERROR WHEN SETTING DATE abhishek.nimonkar@gmail.com
1/3/2008 11:04:02 AM
Hi

I am facing a similar issue. Though my device works on windows CE 6.0
but i think the problem is related.
my device was also working fine since last few months but now from 1st
Jan, the date that is getting set is one day ahead of what i m trying
to set. the hours and minutes are getting set correctly.
I am using SetLocalTime to set the time. As suggested, i tried setting
the date using Date/Time applet in control panel, but the behaviour is
the same. I am also setting the timezone registry in platform.reg file
to set my timezone after every cold boot.

Any help is appreciated.
Thanks
Re: ERROR WHEN SETTING DATE Paul G. Tobey [eMVP]
1/3/2008 12:42:18 PM
So, you're getting a different value from DateTime.Now than what you
actually see on the Date/Time Control Panel applet? Have you tried exiting
all .NET CF applications and restarting them to see if that changes? When
you set the date/time via the Control Panel to today, the current time, it
automatically is shifting the date around on you? That's not happening to
me (I don't have a CE6 device laying around, but it's working perfectly in
CE5). What time zone are you set for?

Paul T.

[quoted text, click to view]

Re: ERROR WHEN SETTING DATE abhishek.nimonkar@gmail.com
1/3/2008 10:04:57 PM
Thanks Paul for the reply. Please find the answers to your Questions.

-------you're getting a different value from DateTime.Now than what
you actually see on the Date/Time Control Panel applet?
No I see the same value in both the cases but it is different from
what I am setting. I am using GetLocalTime API.
-------Have you tried exiting all .NET CF applications and restarting
them to see if that changes?
Yes. I have restarted the device and applications and the problem is
still there.
------- When you set the date/time via the Control Panel to today, the
current time, it automatically is shifting the date aound on you?
Yes. If I set the date for today, it sets the date for tomorrow.
------- What time zone are you set for?
India Standard Time. There is no daylight saving in this time zone.

Code snippet.
//////////////////////////////////////////////////////////
SYSTEMTIME st,st1;
st.wYear = 2008;
st.wMonth = 1;
st.wDate = 4;
.....
.....
::SetLocalTime(&st);
::SetLocalTime(&st); // read somewhere that i need to do this twice.

::GetLocalTime(&st1);
printf("st1.wDay = %d\r\n",st1.wDay);// prints 5 here.
//////////////////////////////////////////////////////////

Thanks
Abhishek
Re: ERROR WHEN SETTING DATE Paul G. Tobey [eMVP]
1/4/2008 8:26:25 AM
[quoted text, click to view]

You're really telling me that, when you change the date/time on the control
panel, it doesn't accept what you enter, but instead changes it to another
date? Sorry, I can't believe that.

[quoted text, click to view]

wDate is not a field in the SYSTEMTIME structure.

[quoted text, click to view]

No.

This has the feel of you having some service running in the background on
this unit, the time service, maybe, and it doing something when you change
the date/time. Check what is running on the device besides your programs.

Paul T.

Re: ERROR WHEN SETTING DATE abhishek.nimonkar@gmail.com
1/4/2008 9:13:03 AM
Hi Paul,

[quoted text, click to view]
that was a typo. its wDay.
I will check on the services thing.

Thanks for the reply,
AddThis Social Bookmark Button