Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
bbb3d27a
Commit
bbb3d27a
authored
Mar 02, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
my_getsystime()
parent
48b6cc2b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
11 deletions
+44
-11
configure.in
configure.in
+1
-1
include/my_sys.h
include/my_sys.h
+1
-0
mysys/Makefile.am
mysys/Makefile.am
+1
-1
mysys/my_getsystime.c
mysys/my_getsystime.c
+40
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+1
-9
No files found.
configure.in
View file @
bbb3d27a
...
...
@@ -1839,7 +1839,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bzero chsize cuserid fchmod fcntl \
getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam
\
getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan
\
localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove
\
mkstemp mlockall perror poll pread pthread_attr_create
\
mkstemp mlockall perror poll pread pthread_attr_create
clock_gettime
\
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam
\
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np
\
pthread_key_delete pthread_rwlock_rdlock pthread_setprio
\
...
...
include/my_sys.h
View file @
bbb3d27a
...
...
@@ -739,6 +739,7 @@ extern ulong crc32(ulong crc, const uchar *buf, uint len);
extern
uint
my_set_max_open_files
(
uint
files
);
void
my_free_open_file_info
(
void
);
ulonglong
my_getsystime
(
void
);
my_bool
my_gethwaddr
(
uchar
*
to
);
/* character sets */
...
...
mysys/Makefile.am
View file @
bbb3d27a
...
...
@@ -34,7 +34,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c \
mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c
\
my_malloc.c my_realloc.c my_once.c mulalloc.c
\
my_alloc.c safemalloc.c my_new.cc
\
my_fopen.c my_fstream.c
\
my_fopen.c my_fstream.c
my_getsystime.c
\
my_error.c errors.c my_div.c my_messnc.c
\
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c
\
my_symlink.c my_symlink2.c
\
...
...
mysys/my_getsystime.c
0 → 100644
View file @
bbb3d27a
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* get time since epoc in 100 nanosec units */
/* thus to get the current time we should use the system function
with the highest possible resolution */
#include "mysys_priv.h"
ulonglong
my_getsystime
()
{
#ifdef HAVE_CLOCK_GETTIME
struct
timespec
tp
;
clock_gettime
(
CLOCK_REALTIME
,
&
tp
);
return
(
ulonglong
)
tp
.
tv_sec
*
10000000
+
(
ulonglong
)
tp
.
tv_nsec
/
100
;
#elif defined(__WIN__)
/* TODO: use GetSystemTimeAsFileTime here or
QueryPerformanceCounter/QueryPerformanceFrequency */
struct
_timeb
tb
;
_ftime
(
&
tb
);
return
(
ulonglong
)
tb
.
time
*
10000000
+
(
ulonglong
)
tb
.
millitm
*
10000
;
#else
/* TODO: check for other possibilities for hi-res timestamping */
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
(
ulonglong
)
tv
.
tv_sec
*
10000000
+
(
ulonglong
)
tv
.
tv_usec
*
10
;
#endif
}
sql/item_strfunc.cc
View file @
bbb3d27a
...
...
@@ -2654,14 +2654,6 @@ static const char hex[] = "0123456789abcdef";
#define UUID_VERSION 0x1000
#define UUID_VARIANT 0x8000
static
ulonglong
get_uuid_time
()
{
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
(
ulonglong
)
tv
.
tv_sec
*
10000000
+
(
ulonglong
)
tv
.
tv_usec
*
10
+
UUID_TIME_OFFSET
+
nanoseq
;
}
static
void
tohex
(
char
*
to
,
uint
from
,
uint
len
)
{
to
+=
len
;
...
...
@@ -2710,7 +2702,7 @@ String *Item_func_uuid::val_str(String *str)
set_clock_seq_str
();
}
ulonglong
tv
=
get_uuid_time
()
;
ulonglong
tv
=
my_getsystime
()
+
UUID_TIME_OFFSET
+
nanoseq
;
if
(
unlikely
(
tv
<
uuid_time
))
set_clock_seq_str
();
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment