This is the Pubnub library for MBed2 ("classic") with the "sync" interface. It is based on the Pubnub C-core library.

Dependencies:   Pubnub_c_core_mbed2_pal

Dependents:   Pubnub_ATT_IoT_SK_WNC_sync Pubnub_ATT_IOT_SK_WNC_AnalogIn_Issue Pubnub_ATT_IoT_SK_WNC_sync_3_27_Fork pubnub_sync

srand_from_pubnub_time.h

Committer:
sveljko
Date:
2016-11-11
Revision:
2:4d49720c7200

File content as of revision 2:4d49720c7200:

#if !defined INC_SRAND_FROM_PUBNUB_TIME
#define      INC_SRAND_FROM_PUBNUB_TIME


#include "pubnub_api_types.h"


/** This helper function will call the C standard srand() function with the seed
    taken from the time returned from Pubnub's `time` operation (which can
    be initiated with pubnub_time()).
    
    It's useful if you want a high-fidelity time used for srand() and on 
    embedded system that don't have a Real-Time Clock.
    
    Keep in mind that this requires a round-trip to Pubnub, so it will take
    some time, depending on your network, at least miliseconds. So, it's best
    used only once, at the start of your program.
    
    @param pbp The Pubnub context to use to get time
    @return 0: OK, -1: error (srand() was not called)
*/
int srand_from_pubnub_time(pubnub_t *pbp);


#endif /* !defined INC_SRAND_FROM_PUBNUB_TIME */