__randname.c\temp\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/temp/__randname.c
blob: e9b970f1f6360dbd7ea9f13ac9948cdf7825b1e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <time.h>
#include <stdint.h>
#include "pthread_impl.h"
/* This assumes that a check for the
 template size has already been made */
char *__randname(char *template)
{
	int i;
	struct timespec ts;
	unsigned long r;
	__clock_gettime(CLOCK_REALTIME, &ts);
	r = ts.tv_sec + ts.tv_nsec + __pthread_self()->tid * 65537UL;
	for (i=0; i<6; i++, r>>=5)
		template[i] = 'A'+(r&15)+(r&16)*2;
	return template;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月09日 14:40:16 +0000

AltStyle によって変換されたページ (->オリジナル) /