function::task_time_string_tid - Linux


The function::task_time_string_tid command creates a time string using the provided timestamp and thread ID (TID). This timestamp is typically obtained from a task_struct object.


function::task_time_string_tid([options]) [<timestamp>] [<tid>]


  • -D, –date: Display the date and time in the format "Xxx 1 Apr 2022 12:34:56".
  • -T, –time: Display the time in the format "12:34:56".
  • -H, –human: Display the time in a human-readable format, such as "20 seconds ago".
  • -u, –utc: Display the time in UTC.
  • -s, –seconds: Display the time in seconds since the epoch.
  • -p, –precision: Specify the precision of the time, in seconds. The default is 6.
  • -h, –help: Display help and usage information.


Example 1: Display the current time in UTC

function::task_time_string_tid -u

Example 2: Display the time in human-readable format

function::task_time_string_tid -H

Example 3: Display the time in seconds since the epoch

function::task_time_string_tid -s

Common Issues

  • Error: Invalid timestamp or TID. Ensure that the timestamp and TID are both valid.
  • Error: Option not recognized. Check the syntax and make sure the option is supported.


function::task_time_string_tid can be combined with other commands to obtain the timestamp and TID. For example:

timestamp=$(cat /proc/<pid>/stat | cut -d ' ' -f22)
tid=$(cat /proc/<pid>/stat | cut -d ' ' -f4)
function::task_time_string_tid $timestamp $tid

Related Commands

  • date: Display or set the system date and time.
  • ps: Display information about running processes.
  • uptime: Display the system uptime and load average.