Name

wstrtime - gets the system time in wide-character format.

Library

libc.lib

Synopsis

  #include <wchar.h>
  wchar_t* wstrtime (const wchar_t *timestr);

Detailed description

The wstrtime() function gets the system time and converts it into wide-character string. This copies the current system time into the string pointed by timestr in the format hh:mm:ss, the timestr buffer must be atleast 9 bytes long.It returns a pointer to the timestr string. Because the modification is done in place, the pointer returned is the same as the pointer passed as the input argument.

Return values

The wstrtime() returns a pointer to the time string, on success else it returns NULL pointer and sets the errno accordingly.

Examples

#include <wchar.h>
/* Illustrates how to use wstrtime API */
int example_wstrtime(void)
{ 
  /* input string which is updated with the system time. */
  wchar_t timestr[20];
 
  wchar_t *res = NULL;
    
  /* function call to get the system time in wide-char format */
  res = wstrtime(timestr);
  if( !res && !timestr)
  {
        printf(" res - %s and timestr - %s",res, timestr);
        return 0;
  }
  else
        return -1;
}

         
Output

         
 res - 15:46:36 and timestr - 15:46:36

         

Errors

The wstrtime function will fail if:
[EFAULT]
  The supplied argument timestr is invalid.

See also

strtime, strftime, strptime.

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top