Browse Source

A wrapper for time information, might have broken windows

Ivan Safrin 13 years ago
parent
commit
942c53bd70
2 changed files with 33 additions and 0 deletions
  1. 14 0
      Core/Contents/Include/PolyCore.h
  2. 19 0
      Core/Contents/Source/PolyCore.cpp

+ 14 - 0
Core/Contents/Include/PolyCore.h

@@ -60,6 +60,20 @@ namespace Polycode {
 		virtual ~PolycodeViewBase(){}
 		virtual ~PolycodeViewBase(){}
 		void *windowData;
 		void *windowData;
 	};
 	};
+	
+	class _PolyExport TimeInfo {
+		public:
+			TimeInfo();
+			
+			int seconds;
+			int minutes;
+			int hours;
+			int month;
+			int monthDay;
+			int weekDay;
+			int year;
+			int yearDay;
+	};	
 
 
 	/**
 	/**
 	* The main core of the framework. The core deals with system-level functions, such as window initialization and OS interaction. Each platform has its own implementation of this base class. NOTE: SOME OF THE FUNCTIONALITY IN THE CORE IS NOT FULLY IMPLEMENTED!!
 	* The main core of the framework. The core deals with system-level functions, such as window initialization and OS interaction. Each platform has its own implementation of this base class. NOTE: SOME OF THE FUNCTIONALITY IN THE CORE IS NOT FULLY IMPLEMENTED!!

+ 19 - 0
Core/Contents/Source/PolyCore.cpp

@@ -29,8 +29,27 @@
 
 
 #endif
 #endif
 
 
+#include <time.h>
+
 namespace Polycode {
 namespace Polycode {
 	
 	
+	TimeInfo::TimeInfo() {
+		time_t rawtime;
+		struct tm * timeinfo;
+		
+		time( &rawtime );
+		timeinfo = localtime ( &rawtime );
+	
+		seconds = timeinfo->tm_sec;
+		minutes = timeinfo->tm_min;
+		hours = timeinfo->tm_hour;
+		month = timeinfo->tm_mon;
+		monthDay = timeinfo->tm_mday;
+		weekDay = timeinfo->tm_wday;
+		year = timeinfo->tm_year;
+		yearDay = timeinfo->tm_yday;
+	}
+	
 	Core::Core(int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex) : EventDispatcher() {
 	Core::Core(int xRes, int yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex) : EventDispatcher() {
 		services = CoreServices::getInstance();
 		services = CoreServices::getInstance();
 		input = new CoreInput();
 		input = new CoreInput();