Register for your free account! | Forgot your password?

You last visited: Today at 13:10

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Last Login Time

Discussion on Last Login Time within the CO2 Private Server forum part of the Conquer Online 2 category.

Closed Thread
 
Old   #1
 
diedwarrior's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
Last Login Time

Hey, after A LOT of trial and error, I couldn't really figure how its used to send the time probably, I tried to control the time sent many times, I figured out there's 4 bytes that controls the time sent, i tried them as ushorts and as a uint, but still they're pretty ******, so i made a command to test em as 4 individual bytes, but yeah, still no luck, so anyone got any information about this ?
diedwarrior is offline  
Old 07/15/2012, 19:33   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Yes. You send seconds as a whole (the whole date (current year - 1970) in seconds)
-impulse- is offline  
Thanks
1 User
Old 07/15/2012, 21:33   #3
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
Unix time - Wikipedia, the free encyclopedia
nTL3fTy is offline  
Thanks
1 User
Old 07/15/2012, 22:44   #4
 
diedwarrior's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
Thanks a lot, appreciate it.
#request close.
diedwarrior is offline  
Old 07/15/2012, 22:45   #5
 
elite*gold: 0
Join Date: Aug 2008
Posts: 94
Received Thanks: 19
Quote:
Originally Posted by -impulse- View Post
Yes. You send seconds as a whole (the whole date (current year - 1970) in seconds)
That means its ulong or 8 bytes ...... eh ?
romeoromeo is offline  
Old 07/15/2012, 22:52   #6
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
It's anywhere from 4 bytes to 8 bytes, usually 8, depending on the format. If it's seconds and not milliseconds, a UInt32 might suffice.
Zeroxelli is offline  
Old 07/15/2012, 23:09   #7
 
diedwarrior's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
No, a uint.
It's using seconds, not ms so a uint is enough.
diedwarrior is offline  
Old 07/15/2012, 23:19   #8
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
Yeah, that's what UInt32 is lol. UInt16 = uShort, UInt64 = uLong
Zeroxelli is offline  
Old 07/15/2012, 23:38   #9
 
diedwarrior's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
-.-, no ****, I already know don't worry xD, didn't see your comment that's why i posted mine.
diedwarrior is offline  
Old 07/15/2012, 23:46   #10
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
Ahh my bad Assumed you might have been confused like I was going from C[++] to C#. I was used to having to do
Code:
typedef unsigned short int ushort;
and such.
Zeroxelli is offline  
Old 07/15/2012, 23:57   #11
 
diedwarrior's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
Ah lol, you seem to be an experienced coder xD.
Anyways here's a quick code to convert in case some people are still finding it hard.
Code:
   public  static double Convert(DateTime date)
        {
            DateTime originaldate = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            TimeSpan a7a = date - originaldate;
            Console.WriteLine(a7a.TotalSeconds);
            return Math.Floor(a7a.TotalSeconds);
          
        }
diedwarrior is offline  
Thanks
1 User
Old 07/16/2012, 00:07   #12
 
Zeroxelli's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 1,769
Received Thanks: 1,143
I've posted this many times before, but here's another way of doing it

Quote:
Originally Posted by Zeroxelli View Post
Also, a heads up. People tend to use Environment.TickCount to measure the distance between two points in time in their servers. This is not good practice! Though it is okay in certain circumstances where the difference in time is less than, say, 3-4 weeks, any more than that and it will wrap around to a negative number and screw up your system. I recommend that it is avoided completely, short of checking the time between things inside the server itself, such as your last jump, attack, etc. Other than that, I recommend you use something like a unix epoch timestamp. As I've posted before, use these functions I've made, or something similar:

Code:
       public static readonly DateTime Epoch = new DateTime(1970, 1, 1);

        public static long Microtime()
        {
            return Convert.ToInt64((DateTime.UtcNow - Epoch).TotalMilliseconds);
        }

        public static long MilliSecondsSince(long UTS)
        {
            return (Microtime() - UTS);
        }

        public static long SecondsSince(long UTS)
        {
            return (Microtime() - UTS) / 1000;
        }
Of course you can make a simple function to return the seconds instead, but "SecondsSince" works nice for calculating the time between now (use Microtime() to get the UTS timestamp for "Now") and the unix epoch.
Zeroxelli is offline  
Thanks
1 User
Old 07/16/2012, 00:09   #13
 
diedwarrior's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 611
Received Thanks: 195
Ah, That's a nice code, thanks .
diedwarrior is offline  
Old 07/16/2012, 01:47   #14
 
nTL3fTy's Avatar
 
elite*gold: 0
Join Date: Jun 2005
Posts: 692
Received Thanks: 353
Code:
[DllImport("msvcrt.dll", EntryPoint = "_time32", CallingConvention = CallingConvention.Cdecl)]
public static extern uint GetUnixTime32(uint timer = 0);

[DllImport("msvcrt.dll", EntryPoint = "_time64", CallingConvention = CallingConvention.Cdecl)]
public static extern ulong GetUnixTime64(ulong timer = 0);
Simple.
nTL3fTy is offline  
Closed Thread


Similar Threads Similar Threads
[HELp] Two Character Same, Login at the same time
08/02/2011 - CO2 Private Server - 3 Replies
someone help me fix this bug?
Login Time Records
11/21/2010 - Silkroad Online - 40 Replies
Post here your longest login time... My: ~21H - Server RedSea
How many time do you take to login WITHOUT PREMIUM
01/18/2010 - Silkroad Online - 60 Replies
brought this old thread up because im interesting and its a fun thread post server and time you do for logging in (and maybe login server like .30) My record is 2 hours with server 30
Login-Time at private?
09/11/2009 - SRO Private Server - 7 Replies
Hey all, how much time do I need, to login on a private server? is there always a free spot? or is it same as normal silkroad?
Best time to login to ECSRO
04/09/2009 - SRO Private Server - 6 Replies
Hi, here I'm again :) Can you tell me what hours of GMT +3 is best to login to ECSRO I mean when ECSRO is not so crowded?



All times are GMT +1. The time now is 13:10.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.