Jump to content
Sign in to follow this  

Alter time with Time Warp

Recommended Posts


Well, I might not be quite right in the head so I decided to make a script that would allow me to change the rate of time. If you put in 4, then time will go 4 times faster. If you put in .5, time will go twice as a slow.

I haven't tested it very thoroughly, but this is what I came up with:

#include <Date.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Global Const $INFINITY = 99999999999999999999
Global Const $YEAR_MAX = $INFINITY
Global Const $MON_MAX = 12, $MON_O = 1
Global $DAY_MAX = _DateDaysInMonth(@YEAR, @MON) ; not a constant because the days in the month cheat
Global Const $HOUR_MAX = 24
Global Const $MIN_MAX = 59
Global Const $SEC_MAX = 59
$rate = Number(InputBox('Time Warp', 'Enter the rate at which time should proceed at.', 2, '', 150, 140))

 If $rate = 0 then
     Msgbox(16, 'Error', 'Time cannot stop.')

$year = @YEAR
$mon = @MON
$day = @MDAY
$hour = @HOUR
$min = @MIN
$sec = @SEC

$tCur = _Date_Time_GetLocalTime()
ConsoleWrite("! Start date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur) & @CRLF)

While 1
    ConsoleWrite('> ' & $hour & ':' & $min & ':' & $sec & @CRLF)
    $tNew = _Date_Time_EncodeSystemTime($mon, $day, $year, $hour, $min, $sec)
    If Not _Date_Time_SetLocalTime(DllStructGetPtr($tNew)) Then
        ConsoleWrite('-> ERROR SETTING LOCAL TIME' & @CRLF)

    $sec += 1
    If $sec > $SEC_MAX then
        $sec = 0
        $min += 1

        If $min > $MIN_MAX then
            $min = 0
            $hour += 1

            If $hour > $HOUR_MAX then
                $hour = 0
                $day += 1

                If $day > $DAY_MAX then
                    $day = 1
                    $mon += 1

                    If $mon > $MON_MAX then
                        $mon = 1
                        $year += 1


    Sleep(1000 * (1 / $rate))


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.