Time Function

  • It is used for returning the current calendar time of the system .
  • The value -1 is returned in case of unavailibility of time .
  • It can also be called with a null pointer .


  • Syntax:

     time_t time(time_t *time);
    
    

    Example:

    
     #include <time.h>
    
      #include <stdio.h>
    
    
    
      int main()
    
      {
    
        struct tm *xyz;
    
        time_t l;
    
        l = time(NULL);
    
        xyz = localtime(&l);
    
        printf(asctime(xyz));
    
        return 0;
    
      }   
    Back