summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-12-17 10:22:36 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-12-17 10:22:36 +0000
commit1b7455e910d1705d8ec8642621c507cb3262ed7d (patch)
tree88b2a23f93bd30a6508b3c23a45d3accf1988d3d
parent719b95493ee3dfdf32a502f914a26ad3d43a023a (diff)
imxtools: fix compilation when cross compiling for windows (tm doesn't have timezone fields)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31342 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/imxtools/sb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/utils/imxtools/sb.c b/utils/imxtools/sb.c
index 23b89e52c8..5e636e99fd 100644
--- a/utils/imxtools/sb.c
+++ b/utils/imxtools/sb.c
@@ -176,7 +176,11 @@ static void compute_sb_offsets(struct sb_file_t *sb)
static uint64_t generate_timestamp()
{
- struct tm tm_base = {0, 0, 0, 1, 0, 100, 0, 0, 1, 0, NULL}; /* 2000/1/1 0:00:00 */
+ struct tm tm_base;
+ memset(&tm_base, 0, sizeof(tm_base));
+ /* 2000/1/1 0:00:00 */
+ tm_base.tm_mday = 1;
+ tm_base.tm_year = 100;
time_t t = time(NULL) - mktime(&tm_base);
return (uint64_t)t * 1000000L;
}
@@ -711,7 +715,11 @@ struct sb_file_t *sb_read_file(const char *filename, bool raw_mode, void *u,
uint64_t micros = sb_header->timestamp;
time_t seconds = (micros / (uint64_t)1000000L);
- struct tm tm_base = {0, 0, 0, 1, 0, 100, 0, 0, 1, 0, NULL}; /* 2000/1/1 0:00:00 */
+ struct tm tm_base;
+ memset(&tm_base, 0, sizeof(tm_base));
+ /* 2000/1/1 0:00:00 */
+ tm_base.tm_mday = 1;
+ tm_base.tm_year = 100;
seconds += mktime(&tm_base);
struct tm *time = gmtime(&seconds);
printf(GREEN, " Creation date/time = ");