Author: spetreolle
Date: Sun Jan 23 13:10:14 2011
New Revision: 50473
URL:
http://svn.reactos.org/svn/reactos?rev=50473&view=rev
Log:
[CMAKE]
WIN32: get build date without overcomplicated string parsing.
Added:
branches/cmake-bringup/tools/getdate.c (with props)
branches/cmake-bringup/tools/getdate.exe (with props)
Modified:
branches/cmake-bringup/include/reactos/version.cmake
branches/cmake-bringup/tools/getdate.cmd
Modified: branches/cmake-bringup/include/reactos/version.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/include/reactos/v…
==============================================================================
--- branches/cmake-bringup/include/reactos/version.cmake [iso-8859-1] (original)
+++ branches/cmake-bringup/include/reactos/version.cmake [iso-8859-1] Sun Jan 23 13:10:14
2011
@@ -1,8 +1,6 @@
macro(today RESULT)
if (WIN32)
- #execute_process(COMMAND "cmd" "/c" "date"
"/T" OUTPUT_VARIABLE ${RESULT})
- #string(REGEX REPLACE "(..)/(..)/(....).*" "\\3\\2\\1"
${RESULT} ${${RESULT}})
- execute_process(COMMAND "${REACTOS_SOURCE_DIR}/tools/getdate.cmd"
OUTPUT_VARIABLE ${RESULT})
+ execute_process(COMMAND "${REACTOS_SOURCE_DIR}/tools/getdate.exe"
OUTPUT_VARIABLE ${RESULT})
string(STRIP ${${RESULT}} ${RESULT})
elseif(UNIX)
execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE
${${RESULT}})
Added: branches/cmake-bringup/tools/getdate.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/tools/getdate.c?r…
==============================================================================
--- branches/cmake-bringup/tools/getdate.c (added)
+++ branches/cmake-bringup/tools/getdate.c [iso-8859-1] Sun Jan 23 13:10:14 2011
@@ -1,0 +1,13 @@
+#include <stdio.h>
+#include <time.h>
+void main()
+{
+ char curdate[9];
+ time_t now;
+ struct tm *tm_now;
+
+ time(&now);
+ tm_now=localtime(&now);
+ strftime(curdate, sizeof(curdate), "%Y%m%d", tm_now);
+ printf("%s", curdate);
+}
Propchange: branches/cmake-bringup/tools/getdate.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/cmake-bringup/tools/getdate.cmd
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/tools/getdate.cmd…
==============================================================================
--- branches/cmake-bringup/tools/getdate.cmd [iso-8859-1] (original)
+++ branches/cmake-bringup/tools/getdate.cmd [iso-8859-1] Sun Jan 23 13:10:14 2011
@@ -1,44 +1,1 @@
-@echo off
-goto test
-
-:get_date_yyyymmdd
-setlocal enableextensions enabledelayedexpansion
-set _RV=
-set _ERR=0
-set _CMD=reg query "HKCU\Control Panel\International" /v sShortDate
-for /f "usebackq skip=2 tokens=3,* delims= " %%i in (`%_CMD%`) do (
-rem Amsterdam/Houston servers:
-rem Short date format (%%i): M/d/yyyy
-rem Sample %DATE%: Thu 05/29/2009
-rem London servers:
-rem Short date format (%%i): dd/MM/yyyy
-rem Sample %DATE%: 29/05/2009
-set D=!DATE!
-rem Uncomment these for debug
-rem echo i: %%i
-rem echo D: !D!
-if "%%i"=="M/d/yyyy" (
-rem I'm assuming the day abbreviation will always be three chars
-rem (so we account for four in total, including the space). So
-rem far, I can attest that this is definitely the case on Wed &
-rem Thu ;-)
-set yyyy=!D:~-4!
-set mm=!D:~-10,-8!
-set dd=!D:~-7,-5!
-) else if "%%i"=="dd/MM/yyyy" (
-set yyyy=!D:~-4!
-set mm=!D:~-7,-5!
-set dd=!D:~-10,-8!
-) else (
-echo fatal: I don't understand this system's date format (%%i^)
-set _ERR=1
-)
-)
-set _RETVAL=!yyyy!!mm!!dd!
-endlocal & set _YYYYMMDD=%_RETVAL% & set _ERROR=%_ERR%
-exit /b %_ERROR%
-
-:test
-call :get_date_yyyymmdd
-rem echo formatted date: %_YYYYMMDD%
-echo %_YYYYMMDD%
+gcc getdate.c -o getdate.exe -s
Added: branches/cmake-bringup/tools/getdate.exe
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/tools/getdate.exe…
==============================================================================
Binary file - no diff available.
Propchange: branches/cmake-bringup/tools/getdate.exe
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream