OpenWrt_Luci_Lua/1_3.test_code/c_test/atoi/atoi.c

35 lines
764 B
C
Raw Normal View History

2015-07-29 12:31:49 +00:00
/*************************************************************************
> File Name: atoi.c
> Description:
> Conclusion:
> Author: rh_Jameson
> Created Time: 20150715 222647
************************************************************************/
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
char buf[50];
char * timestamp()
{
time_t time_stp;
time ( &time_stp );
printf("%ld\n", time_stp);
sprintf(buf, "%d", time_stp);
return buf;
}
int main(int argc, char *argv[])
{
//printf("timestamp: %s\n", timestamp());
char *str = timestamp();
int test = atoi(str);
time_t tt = atoi(str);
printf("%d\n", test);
printf("%d\n", tt);
}