FreeCalypso > hg > fc-selenite
comparison helpers/build-date.c @ 11:b493d3857f4e
helpers: initial import from Magnetite (pruned)
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 15 Jul 2018 21:24:44 +0000 |
| parents | |
| children | e825175be40d |
comparison
equal
deleted
inserted
replaced
| 10:a8f9cc376e98 | 11:b493d3857f4e |
|---|---|
| 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 } |
