Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
GeneralRe: Method Lock Pin
JacquesDP22-Feb-06 19:33
JacquesDP22-Feb-06 19:33 
GeneralRe: Method Lock Pin
emran83422-Feb-06 19:43
emran83422-Feb-06 19:43 
GeneralRe: Method Lock Pin
JacquesDP22-Feb-06 20:11
JacquesDP22-Feb-06 20:11 
GeneralRe: Method Lock Pin
J4amieC22-Feb-06 21:34
J4amieC22-Feb-06 21:34 
QuestionCopyright Problem ? Using Gifs and Images from Web in my Application Pin
emran83422-Feb-06 18:33
emran83422-Feb-06 18:33 
AnswerRe: Copyright Problem ? Using Gifs and Images from Web in my Application Pin
mav.northwind22-Feb-06 20:01
mav.northwind22-Feb-06 20:01 
GeneralRe: Copyright Problem ? Using Gifs and Images from Web in my Application Pin
lmoelleb22-Feb-06 21:08
lmoelleb22-Feb-06 21:08 
AnswerRe: Copyright Problem ? Using Gifs and Images from Web in my Application Pin
Colin Angus Mackay22-Feb-06 22:52
Colin Angus Mackay22-Feb-06 22:52 
GeneralRe: Copyright Problem ? Using Gifs and Images from Web in my Application Pin
emran83423-Feb-06 0:50
emran83423-Feb-06 0:50 
QuestionC#.Net Pin
Ashwani_kumar22-Feb-06 17:31
Ashwani_kumar22-Feb-06 17:31 
AnswerRe: C#.Net Pin
George L. Jackson22-Feb-06 17:39
George L. Jackson22-Feb-06 17:39 
GeneralRe: C#.Net Pin
Ashwani_kumar22-Feb-06 17:41
Ashwani_kumar22-Feb-06 17:41 
GeneralRe: C#.Net Pin
George L. Jackson22-Feb-06 17:48
George L. Jackson22-Feb-06 17:48 
GeneralRe: C#.Net Pin
emran83422-Feb-06 18:19
emran83422-Feb-06 18:19 
GeneralRe: C#.Net Pin
Praveen Nayak23-Feb-06 21:20
Praveen Nayak23-Feb-06 21:20 
GeneralRe: C#.Net Pin
emran83423-Feb-06 23:27
emran83423-Feb-06 23:27 
GeneralRe: C#.Net Pin
Praveen Nayak24-Feb-06 0:09
Praveen Nayak24-Feb-06 0:09 
GeneralTurn off the auto-close quote feature of the IDE... Pin
code-frog22-Feb-06 16:14
professionalcode-frog22-Feb-06 16:14 
QuestionApplication path Pin
jzb22-Feb-06 14:33
jzb22-Feb-06 14:33 
AnswerRe: Application path Pin
Christian Graus22-Feb-06 15:39
protectorChristian Graus22-Feb-06 15:39 
QuestionUTC Time from a C program Pin
mcljava22-Feb-06 14:21
mcljava22-Feb-06 14:21 
AnswerRe: UTC Time from a C program Pin
Jon Sagara22-Feb-06 15:00
Jon Sagara22-Feb-06 15:00 
GeneralRe: UTC Time from a C program Pin
mcljava22-Feb-06 15:43
mcljava22-Feb-06 15:43 
AnswerRe: UTC Time from a C program Pin
George L. Jackson22-Feb-06 17:32
George L. Jackson22-Feb-06 17:32 
GeneralRe: UTC Time from a C program Pin
mcljava23-Feb-06 7:44
mcljava23-Feb-06 7:44 
Thanks for the tip George. Here's what I have encountered:

uint uval // for this example assume it contains the UTC time, a value like 1140713262<br />
DateTime dt = new DateTime( 1970, 1, 1 );<br />
dt.AddSeconds( uval );<br />
Console.WriteLine( "Date is {0}", dt.ToLocalTime( ) );<br />


Here is a real result to illustrate:

2/23/2006 11:49:15 AM: Raw POSIX Date-Time:  1140713262,  Conversion: 12/31/1969 7:00:00 PM<br />


I printed out the 2K/POSIX value, followed by the conversion to local time. I was thinking the conversion should have yielded a date time along the lines of the message preamble 2/23/2006 11:49:15 AM give or take a few seconds in terms of synchronization w/ the server time. However it was off by just a few years!

I was curious to what was happening so I changed the dt.ToLocalTime() to dt.ToUniversalTime() and it yields 1/1/1970 5:00:00 AM. Since the DateTime is initialized to DateTime( 1970, 1, 1 ) this begs the question of just what is dt.AddSeconds( Convert.ToDouble( uval ) ) adding?

Interestingly if I print out dt without the ToLocalTime() conversion it yields 1/1/1970 12:00 AM. That means the seconds added should be 18000 to result in 1/1/1970 5:00:00 AM. This is why I am a little suspect of the 2K/POSIX value, it doesn’t make sense to me to added a 10 digit value and only yield a 5 hour delta since the 1970 epoch.

Now I have quadruple checked the packet decoding logic and I can tell you that all fields before and those after in a variable length packet are all correct and at the appropriate offset. Thus I have revisited the decoding and it appears to be OK in every respect less the date time situation.

At this juncture I am wondering if the 2K flavor of UTC requires any special consideration. Or is there something I am just plain missing? I am stumped.

Final FYI – according to the documentation from the Server vendor, the date-time is stored as followed:

TIME 4 Bytes A date/time, expressed as the number of seconds since Midnight January 1, 1970 Coordinated Universal Time (UTC).

So at least I know I am playing with the right deck, Laugh | :laugh:

Mike Luster

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.