Sign in to follow this  
Followers 0
AzKay

Python To AutoIt

10 posts in this topic

Ive been at this for literally hours, And I still cant figure how to convert this Python code, to AutoIt.

import time
print "%.2f" % time.time()

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



Ive been at this for literally hours, And I still cant figure how to convert this Python code, to AutoIt.

import time
print "%.2f" % time.time()
#Include <date.au3>

$var = _NowCalc()

Msgbox(0,"",$var)


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

I probably shouldve given the return value for it.

1193495987.75

AutoIt, Would return;

2007/10/27 16:41:00


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

I probably shouldve given the return value for it.

1193495987.75

AutoIt, Would return;

2007/10/27 16:41:00

Would _TimeToTicks() work?

#Include <date.au3>
$var = _NowCalc()
Msgbox(0,"",$var) 
$var = StringSplit(StringRight($var,8),":")
$var = _TimeToTicks($var[1],$var[2],$var[3])
Msgbox(0,"",$var)

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I did some research, Appears its based on this:

http://en.wikipedia.org/wiki/Unix_epoch

Timetoticks didnt work.

EDIT::

So, Im guessing its, the ammount of seconds since;

2004-09-16T23:59:58.75

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I did some research, Appears its based on this:

http://en.wikipedia.org/wiki/Unix_epoch

Oh, the current time based on the number of seconds since Epoch, or: Jan 01, 1970.

#Include <date.au3>
$now = _NowCalc()
ConsoleWrite($now & @LF)
$epoch = "1970/01/01 0:0:00"

$var = _DateDiff("s",$epoch,$now)

MsgBox(0,"",$var)
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Epoch, Apparently.

Just found this;

time( )

Return the time as a floating point number expressed in seconds since the epoch, in UTC. Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Getting closer,

python returns; 1193498090

autoit returns; 1193505288


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Got it <_<

We were doing it from the systems time, Instead of the GMT.

EDIT::

Ohsnap.

There it was, right in the help file, under "_NowCalc";

$iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of seconds since EPOCH: " & $iDateCalc )

xD;;

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Ah, my time format was wrong. I use a single zero, not a double zero in the hours/minutes.

By the way, that system of time will blow up in like ... 2030 or something when the double-length integer rolls over.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
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
Sign in to follow this  
Followers 0