RAD Studio
ContentsIndex
PreviousUpNext
stime

Header File 

time.h  

Category 

Time and Date Routines 

Prototype 

int stime(time_t *tp); 

Description 

Sets system date and time. 

stime sets the system time and date. tp points to the value of the time as measured in seconds from 00:00:00 GMT, January 1, 1970. 

Return Value 

stime returns a value of 0. 

Example  

#include <stdio.h>
#include <time.h>
int main(void)
{
  time_t t;
  t = time(NULL);
  printf("Current date is %s", ctime(&t));
  t -= 24L*60L*60L;  /* Back up to same time previous day */
  stime(&t);
  printf("\nNew date is %s", ctime(&t));
   return 0;
}

Portability

POSIX 
Win32 
ANSI C 
ANSI C++ 
 
 
 
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!