Last change
on this file since 398 was 398, checked in by coas-nagasima, 5 years ago |
mbedTLS版Azure IoT Hub接続サンプルのソースコードを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
445 bytes
|
Rev | Line | |
---|
[398] | 1 | #include <time.h>
|
---|
| 2 | #include <stdint.h>
|
---|
| 3 |
|
---|
| 4 | int __clock_gettime(clockid_t, struct timespec *);
|
---|
| 5 |
|
---|
| 6 | /* This assumes that a check for the
|
---|
| 7 | template size has already been made */
|
---|
| 8 | char *__randname(char *template)
|
---|
| 9 | {
|
---|
| 10 | int i;
|
---|
| 11 | struct timespec ts;
|
---|
| 12 | unsigned long r;
|
---|
| 13 |
|
---|
| 14 | __clock_gettime(CLOCK_REALTIME, &ts);
|
---|
| 15 | r = ts.tv_nsec*65537 ^ (uintptr_t)&ts / 16 + (uintptr_t)template;
|
---|
| 16 | for (i=0; i<6; i++, r>>=5)
|
---|
| 17 | template[i] = 'A'+(r&15)+(r&16)*2;
|
---|
| 18 |
|
---|
| 19 | return template;
|
---|
| 20 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.