From 7da7f0d7ae57f38f5faf24106e0af2340631c139 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 7 May 2015 22:45:18 +0200 Subject: [PATCH] [DEV] extract date from ewol --- date/date.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ date/date.h | 24 +++++++++++++++++++++++ lutin_date.py | 36 ++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 date/date.cpp create mode 100644 date/date.h create mode 100644 lutin_date.py diff --git a/date/date.cpp b/date/date.cpp new file mode 100644 index 0000000..314ad90 --- /dev/null +++ b/date/date.cpp @@ -0,0 +1,53 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#include +#ifndef BUILD_YEAR + #define BUILD_YEAR 1070 +#endif +#ifndef BUILD_MONTH + #define BUILD_MONTH 1 +#endif +#ifndef BUILD_DAY + #define BUILD_DAY 1 +#endif +#ifndef BUILD_HOUR + #define BUILD_HOUR 0 +#endif +#ifndef BUILD_MINUTE + #define BUILD_MINUTE 0 +#endif +#ifndef BUILD_SECOND + #define BUILD_SECOND 0 +#endif + +int32_t date::getYear() { + return BUILD_YEAR; +} + +int32_t date::getMonth() { + return BUILD_MONTH; +} + +int32_t date::getDay() { + return BUILD_DAY; +} + +int32_t date::getHour() { + return BUILD_HOUR; +} + +int32_t date::getMinute() { + return BUILD_MINUTE; +} + +int32_t date::getSecond() { + return BUILD_SECOND; +} + + diff --git a/date/date.h b/date/date.h new file mode 100644 index 0000000..bd512d8 --- /dev/null +++ b/date/date.h @@ -0,0 +1,24 @@ +/** + * @author Edouard DUPIN + * + * @copyright 2011, Edouard DUPIN, all right reserved + * + * @license BSD v3 (see license file) + */ + +#ifndef __DATE_H__ +#define __DATE_H__ + +#include + +namespace date { + int32_t getYear(); + int32_t getMonth(); + int32_t getDay(); + int32_t getHour(); + int32_t getMinute(); + int32_t getSecond(); +}; + + +#endif diff --git a/lutin_date.py b/lutin_date.py new file mode 100644 index 0000000..3ea43ca --- /dev/null +++ b/lutin_date.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +import lutinModule as module +import lutinTools as tools +import datetime + +def get_desc(): + return "Date buid date of the program" + + +def create(target): + # module name is 'edn' and type binary. + myModule = module.Module(__file__, 'date', 'LIBRARY') + # add the file to compile: + + + myModule.add_src_file([ + 'date/date.cpp']) + + now = datetime.datetime.now() + + myModule.compile_flags_CC([ + '-Wno-write-strings', + '-Wall', + "-DBUILD_DAY=\""+str(now.day)+"\"", + "-DBUILD_MONTH=\""+str(now.month)+"\"", + "-DBUILD_YEAR=\""+str(now.year)+"\"", + "-DBUILD_HOUR=\""+str(now.hour)+"\"", + "-DBUILD_MINUTE=\""+str(now.minute)+"\"", + "-DBUILD_SECOND=\""+str(now.second)+"\""]) + + myModule.add_export_path(tools.get_current_path(__file__)) + + # add the currrent module at the + return myModule + +