{"thread":{"id":"952","subject":"time casts","startedAt":"2005-06-15T15:30:59Z","lastAt":"2005-06-15T15:30:59Z","messageCount":1,"participants":["Jason Wright"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"4976","messageId":"20050615153058.GD12393@thought.net","threadId":"952","inReplyTo":null,"subject":"time casts","fromName":"Jason Wright","fromEmail":"jason@thought.net","sentAt":"2005-06-15T15:30:59Z","receivedAt":"2005-06-15T15:30:59Z","isPatch":false,"sender":{"key":"jason@thought.net","avatar":null},"body":"In porting cogito/git 0.11.3 to OpenBSD, I ran into casts of time_t\nwarnings for the printfs below.  I think the warnings are harmless, but\nthe patch below fixes 'em.\n\n--Jason L. Wright\n\n--- date.c.orig\tWed Jun 15 11:21:00 2005\n+++ date.c\tWed Jun 15 11:21:30 2005\n@@ -438,7 +438,8 @@ void parse_date(char *date, char *result\n \t\tsign = '-';\n \t}\n \n-\tsnprintf(result, maxlen, \"%lu %c%02d%02d\", then, sign, offset/60, offset % 60);\n+\tsnprintf(result, maxlen, \"%lu %c%02d%02d\", (unsigned long)then,\n+\t    sign, offset/60, offset % 60);\n }\n \n void datestamp(char *buf, int bufsize)\n@@ -451,5 +452,6 @@ void datestamp(char *buf, int bufsize)\n \toffset = my_mktime(localtime(&now)) - now;\n \toffset /= 60;\n \n-\tsnprintf(buf, bufsize, \"%lu %+05d\", now, offset/60*100 + offset%60);\n+\tsnprintf(buf, bufsize, \"%lu %+05d\", (unsigned long)now,\n+\t    offset/60*100 + offset%60);\n }\n--- tar-tree.c.orig\tWed Jun 15 11:24:07 2005\n+++ tar-tree.c\tWed Jun 15 11:24:55 2005\n@@ -318,7 +318,7 @@ static void write_header(const unsigned \n \tif (S_ISDIR(mode) || S_ISLNK(mode))\n \t\tsize = 0;\n \tsprintf(&header[124], \"%011lo\", size);\n-\tsprintf(&header[136], \"%011lo\", archive_time);\n+\tsprintf(&header[136], \"%011lo\", (unsigned)archive_time);\n \n \theader[156] = typeflag;\n \n"}]}