Category : C Source Code
Archive   : WTWG12B.ZIP
Filename : WVALTIME.C

 
Output of file : WVALTIME.C contained in archive : WTWG12B.ZIP
/* wvaltime.c
* validate a time string in form of hh:mm:ss or hh:mm
*
* RETURNS: 0 if time is valid. nonzero otherwise.
* alters the time string by removing extra digits, sapces, etc...
*
* adds missing 'ss' field if not provided originally.
* (ie: buffer must be at least 9 bytes.)
*
*/
#include "wsys.h"


int wval_time ( char *time )
{
int retcode =1;
unsigned int h=100,m=100, s=0; /* NOTE: h,m req'd by default setting */
char *ptr = time;

wdtparse ( &h, &ptr, ':' );
wdtparse ( &m, &ptr, ':' );
wdtparse ( &s, &ptr, ':' );

if ( h<24 && m<60 && s<60 )
{
retcode = 0;
sprintf ( time, "%u:%u:%2.2u", h,m,s);
}


return (retcode); /* wval_time ()*/
}

/*--------------- end of WVALTIME.C --------------------*/

  3 Responses to “Category : C Source Code
Archive   : WTWG12B.ZIP
Filename : WVALTIME.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/