summaryrefslogtreecommitdiff
path: root/bsp/dev3210/newlib_stub.c
blob: a2fd71b9b8daf8d8e27e8b35d1a89cba411d49e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * File      : newlib_stub.c
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rt-thread.org/license/LICENSE
 *
 * Change Logs:
 * Date           Author       Notes
 */

#include <rtthread.h>

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

/* some newlib leaked function in CodeSourcery G++ Lite for MIPS version */

int getpid(void)
{
	return 0;
}

int gettimeofday(struct timeval *__tp, void *__tzp)
{
	struct timespec tp;

	if (libc_get_time(&tp) == 0)
	{
		if (__tp != RT_NULL)
		{
			__tp->tv_sec  = tp.tv_sec;
			__tp->tv_usec = tp.tv_nsec * 1000UL;
		}

		return tp.tv_sec;
	}

	return 0;
}