comparison helpers/build-date.c @ 248:35b17d54773d

helpers: build-date helper program written
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 03 Aug 2017 04:24:06 +0000
parents
children 074e24776948
comparison
equal deleted inserted replaced
247:294c26c07561 248:35b17d54773d
1 /*
2 * This program runs at firmware build time to produce a C file for the
3 * fw build that includes the build date and time stamp.
4 */
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <time.h>
9
10 main(argc, argv)
11 char **argv;
12 {
13 time_t now;
14 struct tm *tm;
15
16 if (argc != 2) {
17 fprintf(stderr, "usage: %s config_name\n", argv[0]);
18 exit(1);
19 }
20 time(&now);
21 tm = gmtime(&now);
22 printf("const char firmware_version_str[] =\n");
23 printf("\"FreeCalypso Magnetite %s, ", argv[1]);
24 printf("build date %d-%02d-%02dT%02d:%02d:%02dZ\";\n",
25 tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
26 tm->tm_hour, tm->tm_min, tm->tm_sec);
27 exit(0);
28 }