Page 1 of 1

Sys_Time still Unaccessable?

PostPosted: Mon Sep 07, 2009 2:41 am
by Blazemann
Is the system time accessable in algodoo? If yes, how?

Re: Sys_Time still Unaccessable?

PostPosted: Mon Sep 07, 2009 6:18 am
by niffirg1
You mean like sim.time?

Re: Sys_Time still Unaccessable?

PostPosted: Mon Sep 07, 2009 6:58 am
by Blazemann
No, I mean the System Time.

Re: Sys_Time still Unaccessable?

PostPosted: Mon Sep 07, 2009 8:37 am
by kilebantick
I think that emil let it remain that way, so that people can not change the time on your computer XD

Re: Sys_Time still Unaccessable?

PostPosted: Mon Sep 07, 2009 10:04 am
by gradyfitz
Blazemann wrote:Is the system time accessable in algodoo? If yes, how?

It is, if you need a quieter method, describe how you'd want it done, and I'll help.

Algodoo receives these values in the variables:
Scene.my.Year (Year),
Scene.my.Month (Month),
Scene.my.Day (Day),
Scene.my.Hour (Hour),
Scene.my.Min (Minute) and
Scene.my.Second (Second).

You will need to have anyone use this program whenever you want to use system time :D.

The source code is as follows:
Code: Select all
#include <Windows.h>
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

void UpdateLoop ();

int main(int argc, char *argv[])
{
    int x = 7;
    int y = 8;
    cout << "Beginning time upadate loop now..." << endl;
   
    for (x = 9; x> y; x++)
        UpdateLoop();

    cout << "Passed time update loop, there has been a problem in execution";
    system("PAUSE");
    return EXIT_SUCCESS;
}

void UpdateLoop()
{
        ofstream LocalTime;
        LocalTime.open("communication.cfg",ios::trunc|ios::out);
        SYSTEMTIME st;
        GetSystemTime(&st);
        LocalTime << "Scene.my.Year = " << st.wYear << ";\nScene.my.Month = " << st.wMonth << ";\nScene.my.Day = " << st.wDay << ";\nScene.my.Hour = " << st.wHour << ";\nScene.my.Min = " << st.wMinute << ";\nScene.my.Second = " << st.wSecond << ";\n";
        LocalTime.close();
        Sleep(100);
}

:D

Re: Sys_Time still Unaccessable?

PostPosted: Mon Sep 07, 2009 4:51 pm
by Blazemann
Thanks Grady, think I will pass thous if it isn't internal.