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_sync

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers srand_from_pubnub_time.h Source File

srand_from_pubnub_time.h

00001 #if !defined INC_SRAND_FROM_PUBNUB_TIME
00002 #define      INC_SRAND_FROM_PUBNUB_TIME
00003 
00004 
00005 #include "pubnub_api_types.h"
00006 
00007 
00008 /** This helper function will call the C standard srand() function with the seed
00009     taken from the time returned from Pubnub's `time` operation (which can
00010     be initiated with pubnub_time()).
00011     
00012     It's useful if you want a high-fidelity time used for srand() and on 
00013     embedded system that don't have a Real-Time Clock.
00014     
00015     Keep in mind that this requires a round-trip to Pubnub, so it will take
00016     some time, depending on your network, at least miliseconds. So, it's best
00017     used only once, at the start of your program.
00018     
00019     @param pbp The Pubnub context to use to get time
00020     @return 0: OK, -1: error (srand() was not called)
00021 */
00022 int srand_from_pubnub_time(pubnub_t *pbp);
00023 
00024 
00025 #endif /* !defined INC_SRAND_FROM_PUBNUB_TIME */