[DEV] extract date from ewol

This commit is contained in:
Edouard DUPIN 2015-05-07 22:45:18 +02:00
commit 7da7f0d7ae
3 changed files with 113 additions and 0 deletions

53
date/date.cpp Normal file
View File

@ -0,0 +1,53 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license BSD v3 (see license file)
*/
#include <date/date.h>
#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;
}

24
date/date.h Normal file
View File

@ -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 <stdint.h>
namespace date {
int32_t getYear();
int32_t getMonth();
int32_t getDay();
int32_t getHour();
int32_t getMinute();
int32_t getSecond();
};
#endif

36
lutin_date.py Normal file
View File

@ -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