logo

utils

Old programs, got split in utils-std and utils-extra git clone https://hacktivis.me/git/utils.git

mdate.c (483B)


  1. // Collection of Unix tools, comparable to coreutils
  2. // SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. // SPDX-License-Identifier: MPL-2.0
  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. }