Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / tool / mkdir_date / mkdir_date.cpp
blob6a8ef9a20faab9cdf38e9b1dfd1fa4b16f32468b
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // mkdir_date.cpp : Defines the entry point for the console application.
20 #include <time.h>
21 #include <stdio.h>
22 #include <direct.h>
24 int main(int argc, char* argv[])
26 // Help
27 if (argc<2)
29 printf ("mkdir_date [directory]");
30 return 0;
33 // Get the time
34 time_t aclock;
35 time(&aclock);
37 // Get time information
38 const struct tm *timeptr=localtime(&aclock);
40 // Format the string
41 char date[512];
42 strftime( date, sizeof(date), "%Y %m %d %Hh%M", timeptr);
44 // Name of the directory
45 char directory[512];
46 sprintf (directory, "%s %s", argv[1], date);
48 // Create a directory
49 return _mkdir( directory )==0;