summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-06-22 14:15:25 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-06-22 14:15:25 -0700
commit9eafe86d58a2d2b30e8b33f6697519fc7f104443 (patch)
tree511646eac969baa9feef1b949696a5b6a66e94d8 /strbuf.h
parentMerge branch 'sd/t3200-branch-m-test' (diff)
parentdate: use localtime() for "-local" time formats (diff)
downloadtgif-9eafe86d58a2d2b30e8b33f6697519fc7f104443.tar.xz
Merge branch 'rs/strbuf-addftime-zZ'
As there is no portable way to pass timezone information to strftime, some output format from "git log" and friends are impossible to produce. Teach our own strbuf_addftime to replace %z and %Z with caller-supplied values to help working around this. * rs/strbuf-addftime-zZ: date: use localtime() for "-local" time formats t0006: check --date=format zone offsets strbuf: let strbuf_addftime handle %z and %Z itself
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/strbuf.h b/strbuf.h
index 80047b1bb7..4559035c47 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -340,8 +340,14 @@ extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap);
/**
* Add the time specified by `tm`, as formatted by `strftime`.
- */
-extern void strbuf_addftime(struct strbuf *sb, const char *fmt, const struct tm *tm);
+ * `tz_name` is used to expand %Z internally unless it's NULL.
+ * `tz_offset` is in decimal hhmm format, e.g. -600 means six hours west
+ * of Greenwich, and it's used to expand %z internally. However, tokens
+ * with modifiers (e.g. %Ez) are passed to `strftime`.
+ */
+extern void strbuf_addftime(struct strbuf *sb, const char *fmt,
+ const struct tm *tm, int tz_offset,
+ const char *tz_name);
/**
* Read a given size of data from a FILE* pointer to the buffer.