Skip to content

Latest commit

 

History

48 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status TimeFormatStrings

This handy C library can read and write time format strings in four formats: Excel (TFS_EXCEL), POSIX (TFS_POSIX), Stata (TFS_STATA), and Unicode (TFS_UTS35).

It can also read, but not write, format strings in SAS format (TFS_SAS) and SPSS format (TFS_SPSS).

Example usage:

#include "tfs.h"

char result[100];
tfs_error_e error = tfs_convert("mm/dd/yyyy", TFS_EXCEL,
                                result, TFS_UTS35, sizeof(result));
if (error == TFS_OK) {
    printf("%s\n", result); /* prints "MM/dd/y" */
}

The POSIX format can be fed to strftime and strptime in order to present and parse specific time values.

tfs_convert returns TFS_PARSE_ERROR if the input is not a valid format string, TFS_CANT_REPRESENT if the output format has no equivalent for one of the input's fields (for example a time zone in an Excel format), and TFS_MORE_BUFFER_PLEASE if the output does not fit. In every case the output buffer holds a NUL-terminated string, truncated if necessary.

Type "make" to build the library and "make test" to run the test suite.

About

Convert Excel, POSIX, Stata, and Unicode time format strings

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages