Implemented strftime()

This commit is contained in:
2022-05-10 20:51:02 +01:00
parent 9172a10a93
commit 91e7cf0bd0
9 changed files with 1201 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
#include <stddef.h> #include <stddef.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h>
#include <sys/_time.h> #include <sys/_time.h>
#define CLOCKS_PER_SEC __SYS_CLOCKS_PER_SEC #define CLOCKS_PER_SEC __SYS_CLOCKS_PER_SEC
@@ -32,4 +33,6 @@ extern struct tm *localtime(const time_t *timer);
extern time_t mktime(struct tm *timeptr); extern time_t mktime(struct tm *timeptr);
extern size_t strftime(char *str, size_t max, const char *format, const struct tm *timeptr); extern size_t strftime(char *str, size_t max, const char *format, const struct tm *timeptr);
extern void tzset(void);
#endif #endif

View File

@@ -3,7 +3,4 @@
#include <time.h> #include <time.h>
extern clock_t __sys_clock(void);
extern time_t __sys_time(void);
#endif #endif

View File

@@ -8,6 +8,7 @@
#include <magenta/object.h> #include <magenta/object.h>
#include <mio/object.h> #include <mio/object.h>
#include <mio/fd.h> #include <mio/fd.h>
#include <mio/fs.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "__init.h" #include "__init.h"

View File

@@ -3,4 +3,9 @@
#define __SYS_CLOCKS_PER_SEC 1000000000 #define __SYS_CLOCKS_PER_SEC 1000000000
#include <time.h>
extern clock_t __sys_clock(void);
extern time_t __sys_time(void);
#endif #endif

View File

@@ -0,0 +1,16 @@
#ifndef SYS_HORIZON_TIME_H_
#define SYS_HORIZON_TIME_H_
#include <time.h>
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
#endif

View File

@@ -4,4 +4,24 @@
#include <machine/_stdint.h> #include <machine/_stdint.h>
#include <mio/types.h> #include <mio/types.h>
typedef signed long long blkcnt_t;
typedef signed long long blksize_t;
typedef unsigned long long clock_t;
typedef unsigned int clockid_t;
typedef unsigned long long fsblkcnt_t;
typedef unsigned long long fsfilcnt_t;
typedef unsigned int gid_t;
typedef unsigned int id_t;
typedef unsigned int key_t;
typedef unsigned int mode_t;
typedef unsigned long long nlink_t;
typedef __int64_t off64_t;
typedef signed int pid_t;
typedef unsigned long long time_t;
typedef unsigned int timer_t;
typedef unsigned int uid_t;
typedef unsigned long useconds_t;
typedef long suseconds_t;
typedef unsigned long long dev_t;
#endif #endif

View File

@@ -1,5 +1,5 @@
#include <time.h> #include <time.h>
#include <__time.h> #include <sys/_time.h>
clock_t clock(void) clock_t clock(void)
{ {

File diff suppressed because it is too large Load Diff

4
photon/libc/time/tzset.c Normal file
View File

@@ -0,0 +1,4 @@
void tzset(void)
{
}