Skip to content

Instantly share code, notes, and snippets.

@miri64
Last active August 29, 2015 14:26
Show Gist options
  • Save miri64/b246a473811791384bcc to your computer and use it in GitHub Desktop.
Save miri64/b246a473811791384bcc to your computer and use it in GitHub Desktop.
/*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief timex_to_str test application
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*
* @}
*/
#include <stdio.h>
#include "timex.h"
int main(void)
{
timex_t t = { 0, 0 };
char t_str[TIMEX_MAX_STR_LEN];
puts(timex_to_str(t, t_str));
t.seconds = 1;
puts(timex_to_str(t, t_str));
t.seconds = 9;
t.microseconds = 2640288149; /* should be 2649.288149 */
puts(timex_to_str(t, t_str));
t.seconds = 1689940699;
t.microseconds = 4361; /* should be 2649.288149 */
puts(timex_to_str(t, t_str));
t.seconds = UINT32_MAX;
t.microseconds = 999999; /* should be .999999 */
puts(timex_to_str(t, t_str));
return 0;
}
APPLICATION = timex_to_str
BOARD ?= native
RIOTBASE ?= $(CURDIR)/../RIOT
QUIET ?= 1
USEMODULE += timex
CFLAGS += -DLOG_LEVEL=LOG_NONE
include $(RIOTBASE)/Makefile.include
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment