logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git

mdate.c (504B)


  1. // Collection of Unix tools, comparable to coreutils
  2. // SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
  4. #define _POSIX_C_SOURCE 200809L
  5. #include <stdio.h> /* printf */
  6. #include <time.h> /* time */
  7. // 3600*24.5
  8. #define cycle 88200
  9. int
  10. main(void)
  11. {
  12. time_t now = time(NULL);
  13. time_t date_now = now / cycle;
  14. time_t time_now = now % cycle;
  15. printf("%lX,%05lX\n", date_now, time_now);
  16. return 0;
  17. }