function::task_utime - Linux


The function::task_utime is a function exposed by the libchampollion library. It updates the access and modification times of a file.


int task_utime(const char *path, const struct timespec *times);
  • path: The path to the file.
  • times: A pointer to a timespec structure containing the new access and modification times.




#include <libchampollion.h>

int main() {
  struct timespec times = {.tv_sec = 1658038400, .tv_nsec = 0};
  int ret = task_utime("file.txt", &times);
  if (ret != 0) {
    // Error handling
  return 0;

Common Issues

  • Make sure that the user has the necessary permissions to change the file’s timestamps.
  • Ensure that the times structure is valid.


task_utime can be combined with other file and directory management functions like task_stat and task_mkdir.

Related Commands

  • utime: A similar function in the C standard library.
  • touch: A command-line utility to change file timestamps.