Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ New timestamps feature in version 4.62

New timestamps feature in version 4.62

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #15 on Tue 28 Sep 2010 05:28 AM (UTC)
Message
Ah -- it was probably for high-performance timing, yes. The Unix version gives you the actual time of day whereas the Windows version measures it according to program lifetime or something like that. That must be the offset stuff you were talking about: using an initial timestamp along with the high-performance timer, and then adding the difference of the current high-perf timer and the original high-perf timer to the original timestamp.

Actually I'm a little surprised that that gets you the kind of time drift you were talking about... oh well.

Sorry for the noise. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Larkin   (278 posts)  Bio
Date Reply #16 on Tue 28 Sep 2010 03:18 PM (UTC)
Message
I have code for a Windows version of gettimeofday that has served me well on a few projects. If it's useful to you in any way, you're welcome to it!

int gettimeofday(struct timeval* tv, struct timezone* tz)
{
  static __int64 Adjustment = 0;
  __int64 Now = 0;
  
  if (!Adjustment)
  {
    SYSTEMTIME st = {1970,1,0,1,0,0,0};
    SystemTimeToFileTime(&st, (LPFILETIME)&Adjustment);
  }
  
  GetSystemTimeAsFileTime((LPFILETIME)&Now);
  Now -= Adjustment;
  
  tv->tv_sec = (long)(Now / 10000000);
  tv->tv_usec = (long)((Now / 100) - (((__int64)tv->tv_sec * 1000) * 100));
  return 0;
}
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #17 on Tue 28 Sep 2010 09:25 PM (UTC)
Message
Thanks for that. I must have missed that before. I note from MSDN this comment however "Warning: this method only returns the time in resolutions of 15ms (0.015s)".

Whilst that is better than one second resolution, it isn't as good as the high-precision timers.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Flek   (4 posts)  Bio
Date Reply #18 on Sun 19 Dec 2010 01:03 PM (UTC)
Message
Im currently using a modified version of your chat redirecting script. I have it sorting my ic channels and my ooc channels into two seperate windows. I tried to add this plugin and I get the following

[WARNING] C:\Program Files (x86)\MUSHclient\worlds\plugins\Timestamps.xml
Line 24: Invalid '--' inside comment (Cannot load)

Being a complete newb to scripting I cannot figure this out.

Help please?
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #19 on Sun 19 Dec 2010 08:01 PM (UTC)
Message
Near the start of the plugin is this:


Special characters for date/time etc.
-------------------------------------


Just delete the line with the hyphens in it. I must have added that without testing.

It's just a comment anyway.

I amended the original to not have that line in it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


84,502 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.