home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snip9707.zip / TIME__.C < prev    next >
Text File  |  1997-07-05  |  2KB  |  62 lines

  1. /* +++Date last modified: 05-Jul-1997 */
  2.  
  3. /*
  4.  /-------------------------------------\
  5. |     TIME_MAC_CONV                     |------------------------------------|
  6. |\-------------------------------------/
  7. |
  8. | This routine converts the macro  __TIME__ to standard format
  9. |
  10. | Example:   "11:50:21" -> "115021"
  11. |
  12. |----------------------------------------------------------------------------|
  13. | CALL:
  14. |    strcpy(string, time_mac_conv(string) );
  15. |
  16. | HEADER:
  17. |    string.h    : strcpy
  18. |    stdio.h     : sscanf, sprintf
  19. |
  20. | GLOBALE VARIABLES:
  21. |    %
  22. |
  23. | ARGUMENTS:
  24. |    pszTime      : String with time in  __TIME__ format (HH:MM:SS)
  25. |
  26. | PROTOTYPE:
  27. |    char far *time_mac_conv(char *pszTime);
  28. |
  29. | RETURN VALUE:
  30. |    char szStr   : Time in format HHMMSS
  31. |
  32. | MODULE:
  33. |    time__.c
  34. |----------------------------------------------------------------------------|
  35. |
  36. |
  37. |----------------------------------------------------------------------------|
  38. |1992-09-16/Erik Bachmann
  39. \---------------------------------------------------------------------------|*/
  40.  
  41. char _CfnTYPE *time_mac_conv(char *pszTime)
  42. {
  43.       char  szStr[12];                                /* Convertion string */
  44.       char  hh[3],                                    /* Hour     */
  45.             mm[3],                                    /* Minutes  */
  46.             ss[3];                                    /* Seconds  */
  47.  
  48.       /*----------------------------------------------*/
  49.  
  50.       strcpy(szStr, pszTime);                         /* Copy string */
  51.  
  52.       sscanf(szStr, "%2s %*c %2s %*c %2s", hh, mm, ss);
  53.  
  54.       /* Split the string into basics */
  55.  
  56.       sprintf(szStr, "%s%s%s", hh,mm,ss);
  57.  
  58.       /* Assemble new string */
  59.  
  60.       return((char *) szStr);                         /* Return new string */
  61. }
  62.