Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 9259 → Rev 9260

/programs/develop/ktcc/trunk/libc.obj/source/time/asctime.c
1,3 → 1,4
#include "stddef.h"
#include <errno.h>
#include <stdlib.h>
#include <time.h>
9,15 → 10,21
#pragma GCC push_options
#pragma GCC optimize("O0")
 
#define TIME_STR_MAX 27
 
char *asctime(const struct tm *tm){
static char time_str[30];
if(tm->tm_wday>7 || tm->tm_wday<1 || tm->tm_mon<1 || tm->tm_mon>12){
if(!tm){
errno = EINVAL;
return NULL;
}
snprintf(time_str, 26, "%.3s %.3s%3d %2d:%2d:%2d %d\n",
wday_str[tm->tm_wday-1],
mon_str[tm->tm_mon-1],
if(tm->tm_wday>6 || tm->tm_wday<0 || tm->tm_mon<0 || tm->tm_mon>11){
errno = EINVAL;
return NULL;
}
static char time_str[TIME_STR_MAX];
snprintf(time_str, TIME_STR_MAX-1, "%.3s %.3s%3d %02d:%02d:%02d %d\n",
wday_str[tm->tm_wday],
mon_str[tm->tm_mon],
tm->tm_mday, tm->tm_hour,
tm->tm_min, tm->tm_sec,
1900 + tm->tm_year
/programs/develop/ktcc/trunk/libc.obj/source/time/mktime.c
2,7 → 2,7
 
time_t mktime (struct tm * timeptr)
{
int utcdiff = -3;
// int utcdiff = -3;
const int mon_days [] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
unsigned long int tyears, tdays, leaps, utc_hrs;
int i;
17,7 → 17,7
tdays += timeptr->tm_mday-1; // days of month passed.
tdays = tdays + (tyears * 365) + leaps;
 
utc_hrs = timeptr->tm_hour + utcdiff; // for your time zone.
return (tdays * 86400) + (utc_hrs * 3600) + (timeptr->tm_min * 60) + timeptr->tm_sec;
// utc_hrs = timeptr->tm_hour + utcdiff; // for your time zone.
return (tdays * 86400) + (timeptr->tm_hour * 3600) + (timeptr->tm_min * 60) + timeptr->tm_sec;
}
/programs/develop/ktcc/trunk/libc.obj/source/time/time.c
1,9 → 1,8
#include <time.h>
#include <sys/ksys.h>
 
time_t time(time_t *timer){
static struct tm __buffertime;
 
time_t time(time_t *timer){
int kos_date, kos_time;
kos_date = _ksys_get_date().val;
kos_time = _ksys_get_time().val;
29,6 → 28,5
if(timer){
*timer=ret;
}
return ret;
}