Sys_Time still Unaccessable?
6 posts • Page 1 of 1
Sys_Time still Unaccessable?
Is the system time accessable in algodoo? If yes, how?
-

Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Sys_Time still Unaccessable?
You mean like sim.time?
-

niffirg1 - Posts: 376
- Joined: Mon Aug 31, 2009 10:31 pm
- Location: The Great American South!
Re: Sys_Time still Unaccessable?
No, I mean the System Time.
-

Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
Re: Sys_Time still Unaccessable?
I think that emil let it remain that way, so that people can not change the time on your computer XD
-

kilebantick - Posts: 1267
- Joined: Tue Sep 01, 2009 9:50 am
Re: Sys_Time still Unaccessable?
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
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);
}
- Attachments
-
Local Time.rar- LocalTime 3 (Version 2)
I hope I chose the right file :).
Provided it is, this program will update the system time in phun constantly (as long as you run it). - (104.38 KiB) Downloaded 140 times
- gradyfitz
- Posts: 174
- Joined: Tue Sep 01, 2009 8:33 am
- Location: Victoria, Australia
Re: Sys_Time still Unaccessable?
Thanks Grady, think I will pass thous if it isn't internal.
-

Blazemann - Posts: 151
- Joined: Tue Sep 01, 2009 1:19 am
6 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests




