Nigel Rantor / azure_c_shared_utility

Fork of azure_c_shared_utility by Azure IoT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers agenttime_mbed.c Source File

agenttime_mbed.c

00001 // Copyright (c) Microsoft. All rights reserved.
00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
00003 
00004 #include "azure_c_shared_utility/agenttime.h"
00005 
00006 // mbed version of gmtime() returns NULL.
00007 // system RTC should be set to UTC as its localtime 
00008 
00009 time_t get_time(time_t* currentTime)
00010 {
00011     return time(currentTime);
00012 }
00013 
00014 double get_difftime(time_t stopTime, time_t startTime)
00015 {
00016     return difftime(stopTime, startTime);
00017 }
00018 
00019 
00020 struct tm* get_gmtime(time_t* currentTime)
00021 {
00022     return localtime(currentTime);
00023 }
00024 
00025 char* get_ctime(time_t* timeToGet)
00026 {
00027     return ctime(timeToGet);
00028 }