Skip to main content
added 61 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

If you like to get the current time_t, this can be done by calling srand() and then call t = srand().

$ awk 'BEGIN{srand(); print srand()}'
1440536144

This works as posix requires the random function to be initialized with the current time if called without arg and to return the previous seed.

If you like to get the current time_t, this can be done by calling srand() and then call t = srand().

This works as posix requires the random function to be initialized with the current time if called without arg and to return the previous seed.

If you like to get the current time_t, this can be done by calling srand() and then call t = srand().

$ awk 'BEGIN{srand(); print srand()}'
1440536144

This works as posix requires the random function to be initialized with the current time if called without arg and to return the previous seed.

Source Link
schily
  • 19.7k
  • 5
  • 41
  • 61

If you like to get the current time_t, this can be done by calling srand() and then call t = srand().

This works as posix requires the random function to be initialized with the current time if called without arg and to return the previous seed.