knadh / dns.toys

A DNS server that offers useful utilities and services over the DNS protocol. Weather, world time, unit conversion etc.
https://www.dns.toys
MIT License
2.48k stars 135 forks source link

Support for epoch conversions #39

Closed aneeraj closed 1 year ago

aneeraj commented 1 year ago

I had worked on adding support for epoch time conversions to human readable on my fork.

% dig 784783800.epoch @127.0.0.1 -p 5354   

;; QUESTION SECTION:
;784783800.epoch.       IN  A

;; ANSWER SECTION:
784783800.      1   IN  TXT "1994-11-14 09:00:00 +0530 IST"

If you are okay with this, I can send in the PR.

Thanks and have a happy weekend! :slightly_smiling_face:

varunlakkur commented 1 year ago

I like this idea. This is useful for me too. Can we have a switch for UTC or other timezones too? Something like:

❯ dig 784783800-UTC.epoch @127.0.0.1 -p 5354   

;; QUESTION SECTION:
;784783800.epoch.       IN  A

;; ANSWER SECTION:
784783800.      1   IN  TXT "1994-11-14 09:00:00 UTC"
aneeraj commented 1 year ago

Hey @varunlakkur

Thanks for the suggestion! I made a quick change such that the result now includes both UTC and local time.

% dig 784783800.epoch @127.0.0.1 -p 5354

;; QUESTION SECTION:
;784783800.epoch.       IN  A

;; ANSWER SECTION:
784783800.      1   IN  TXT "1994-11-14 03:30:00 +0000 UTC" "1994-11-14 09:00:00 +0530 IST"
knadh commented 1 year ago

Thanks @aneeraj. Please do send a PR.