示例#1
0
文件: btime.c 项目: halgandd/bacula
/* Deprecated. Do not use. */
void date_time_decode(struct date_time *dt,
                      uint32_t *year, uint8_t *month, uint8_t *day,
                      uint8_t *hour, uint8_t *minute, uint8_t *second,
                      float32_t *second_fraction)
{
    date_decode(dt->julian_day_number, year, month, day);
    time_decode(dt->julian_day_fraction, hour, minute, second, second_fraction);
}
示例#2
0
文件: btime.c 项目: halgandd/bacula
/* Deprecated. Do not use. */
void tm_decode(struct date_time *dt,
                      struct tm *tm)
{
    uint32_t year;
    uint8_t month, day, hour, minute, second;

    date_decode(dt->julian_day_number, &year, &month, &day);
    time_decode(dt->julian_day_fraction, &hour, &minute, &second, NULL);
    tm->tm_year = year - 1900;
    tm->tm_mon = month - 1;
    tm->tm_mday = day;
    tm->tm_hour = hour;
    tm->tm_min = minute;
    tm->tm_sec = second;
}
示例#3
0
文件: vdt-1.0.c 项目: vSlipenchuk/vdb
// Lчтыхў№ ёюёЄрты ¦•шх шч яюыэющ фрЄv/тЁхьхэш Date
int dt_decode(date_time DT,
        int *Year, int *Month, int *Day,
        int *Hour, int *Min,   int *Sec) {
date_decode(DT,Year,Month,Day); time_decode(DT,Hour,Min,Sec);
return *Year>0 && *Month>0 && *Day>0;
}
示例#4
0
bool
display_status(void)
{
    static uint32_t bytes_sent;
    static uint32_t bytes_received;
    static uint32_t	rate;

    // Clear screen
    putchar(CTRL(FF));

    struct datetime_t datetime;
    time_decode(&datetime, clock_time());

    printf_P(PSTR("Time: %02d:%02d:%02d\n\n"), datetime.hour, datetime.min, datetime.sec);

    const struct net_status_t* net_status;
    net_status = net_get_status();

    printf_P(PSTR("Network connection:\n"));
    printf_P(PSTR(" Link state: [ %s ]\n\n"), (net_status->link) ? "UP" : "DOWN");

    printf_P(PSTR(" Packets sent: %lu\n"), net_status->packets_sent);

    printf_P(PSTR(" Data sent: "));

    if(net_status->bytes_sent < 1024) {
        printf_P(PSTR("%lu Bytes\n"), net_status->bytes_sent);
    } else if(net_status->bytes_sent < 1048576) {
        printf_P(PSTR("%lu kB\n"), net_status->bytes_sent / 1024);
    } else {
        printf_P(PSTR("%lu MB\n"), net_status->bytes_sent / 1048576);
    }

    rate = net_status->bytes_sent - bytes_sent;

    printf_P(PSTR(" Data rate: "));

    if(rate < 1024) {
        printf_P(PSTR("%lu B/s\n\n"), rate);
    } else if(rate < 1048576) {
        printf_P(PSTR("%lu kB/s\n\n"), rate / 1024);
    } else {
        printf_P(PSTR("%lu MB/s\n\n"), rate / 1048576);
    }

    bytes_sent = net_status->bytes_sent;


    printf_P(PSTR(" Packets received: %lu\n"), net_status->packets_received);

    printf_P(PSTR(" Data received: "));

    if(net_status->bytes_received < 1024) {
        printf_P(PSTR("%lu Bytes\n"), net_status->bytes_received);
    } else if(net_status->bytes_received < 1048576) {
        printf_P(PSTR("%lu kB\n"), net_status->bytes_received / 1024);
    } else {
        printf_P(PSTR("%lu MB\n"), net_status->bytes_received / 1048576);
    }

    rate = net_status->bytes_received - bytes_received;

    printf_P(PSTR(" Data rate: "));

    if(rate < 1024) {
        printf_P(PSTR("%lu B/s\n"), rate);
    } else if(rate < 1048576) {
        printf_P(PSTR("%lu kB/s\n"), rate / 1024);
    } else {
        printf_P(PSTR("%lu MB/s\n"), rate / 1048576);
    }

    bytes_received = net_status->bytes_received;

    return true;
}