aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-07-15 23:08:04 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-07-15 23:08:04 +0200
commit21121a8ab2692c2976f1be8c4779bef064b7df1c (patch)
tree0cfb0168b869abcfc6f686a6289764ae54800ae7
parent70c37f3318a563a7d13104a0dfebddd14870244d (diff)
downloadwcal-21121a8ab2692c2976f1be8c4779bef064b7df1c.tar.gz
wcal-21121a8ab2692c2976f1be8c4779bef064b7df1c.tar.xz
wcal-21121a8ab2692c2976f1be8c4779bef064b7df1c.zip
interpret current timestamp as local time
-rw-r--r--wcal.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/wcal.c b/wcal.c
index 21ced91..294002b 100644
--- a/wcal.c
+++ b/wcal.c
@@ -56,10 +56,19 @@ parse_isodate(char *optarg, struct tm *tm)
int
main(int argc, char *argv[])
{
+ time_t now = time(0);
+ struct tm *tm = localtime(&now);
+ struct tm tm2 = {
+ .tm_year = tm->tm_year,
+ .tm_mon = tm->tm_mon,
+ .tm_mday = tm->tm_mday
+ };
+
setenv("TZ", "", 1);
+ tzset();
- time_t now = time(0);
- struct tm *tm = gmtime(&now);
+ now = mktime(&tm2);
+ tm = gmtime(&now);
int c;
while ((c = getopt(argc, argv, "13cCid:y")) != -1)