Jump to content
  • Advertisement
Sign in to follow this  

[.net] sbyte to System.Timezone?

This topic is 4756 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, here's the thing - I have a class, that I did not make, that has a constructor that takes a TimeZone instance as a parameter;
        public ServerInfo(string name, int fullPercent, TimeZone tz, IPEndPoint address)
            m_Name = name;
            m_FullPercent = fullPercent;
            m_TimeZone = tz.GetUtcOffset(DateTime.Now).Hours;
            m_Address = address;
Now, that's all well and dandy, but the problem is that the project that this class is in happens to be a server. As such, it creates a packet containing a lot of ServerInfo instances. However, as I'm creating a client for this server, I need to know how to retrieve the data of this packet. The problem is that the server, when it creates the packet in question, converts the ServerInfo's m_TimeZone member to an sbyte like so:
Now, obviously this poses a problem for me when I'm trying to create a new ServerInfo class instance in the client based on the information in the packet, since I have to somehow convert an sbyte into a System.TimeZone instance. So far this has proven impossible because System.TimeZone doesn't have any constructors and is impossible to explicitly convert to an sbyte (I.E doing so generates an error). Any suggestions? Thanks in advance!

Share this post

Link to post
Share on other sites
There's some interesting TimeZone stuff here:

The TimeZone class is abstract, so the server must be converting a derived class to an sbyte. So, if you could figure out what class that's actually being used, you might have a better chance of converting the sbyte back into a TimeZone-derived object.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!