Jump to content

TimerInit() returns different tamp on different systems?


E1M1
 Share

Recommended Posts

I found that TimerInit() returns different timestamps on different machines. Time is same on both machines 21 aug 2012 20:33.

On 32 bit xp machine I get 17452391718

On 64 bit win 7 (au3 is still 32 bit) I get 94856379079

This difference is huge. Basically I want to add ping command to server - I send ping packet to server and then server sends back the return value of TimerInit() so that I can calculate time difference on client side. Does anyone know what might cause it? Any alternatives to TimerInit() you could suggest?

edited

Link to comment
Share on other sites

TimerInit doesn't return a timestamp, so trying to read what it returns is irrelevant. See bug tracker tickets #2025, and #2008 for more of an explanation.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thanks for info.

Help file said:

Returns a timestamp (in milliseconds).

Which seems to be wrong in this case.

Anything I could use for what I want to do?

Edit: I came up with that:

based on but these are 2 timestamps that are calculated on same second 607893382656 and 541842352128. Just wondering if anything is wrong with algorithm.

Func TimeStamp()
    Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')
    DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))
    $sMilliSeconds = 1
    For $i = 1 to 8
        $sMilliSeconds *= DllStructGetData($stSystemTime, $i)
    Next
    $stSystemTime = 0
    Return $sMilliSeconds
EndFunc
Edited by E1M1

edited

Link to comment
Share on other sites

  • Moderators

E1M1,

Be careful deciding that number are "random" - randomness is a very difficult concept and the value you are getting from that code is nowhere near random. The Random function uses a very good alogorithm and is as good as you can get for normal purposes. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Sorry for that. By random I meant that when sleep time is always same TimeStamp()-$time is always different. I am currently trying to figure out how to properly convert this to timestamp

Edited by E1M1

edited

Link to comment
Share on other sites

  • Moderators

E1M1,

to properly convert this to timestamp

_NowCalc. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Timestamp's come in many different flavors. And should not really be shared across different systems (unless your sure there of the same flavor ... and there synchronized down to the lowest(at least) used unit.)

For additional information/data on the AutoIt TimeStamp() you might like to take a look at the code in the AutoIt included "Timers.au3" UDF.

[edit: something]

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...