mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-7112 sub-second precision (where available)
X-SVN-Rev: 27210
This commit is contained in:
parent
fdc609672d
commit
48ea42eecd
8 changed files with 157 additions and 23 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@ icu4c/source/README
|
|||
icu4c/source/allinone/*.ncb
|
||||
icu4c/source/allinone/*.opt
|
||||
icu4c/source/allinone/*.suo
|
||||
icu4c/source/autom4te.cache
|
||||
icu4c/source/bin
|
||||
icu4c/source/common/*.ao
|
||||
icu4c/source/common/*.d
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#******************************************************************************
|
||||
#
|
||||
# Copyright (C) 1998-2009, International Business Machines
|
||||
# Copyright (C) 1998-2010, International Business Machines
|
||||
# Corporation and others. All Rights Reserved.
|
||||
#
|
||||
#******************************************************************************
|
||||
|
@ -170,7 +170,7 @@ clean-local:
|
|||
|
||||
distclean-local: clean-local
|
||||
$(RMV) $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc $(top_builddir)/config/icu-config
|
||||
$(RMV) config.cache config.log config.status $(top_builddir)/config/icucross.mk
|
||||
$(RMV) config.cache config.log config.status $(top_builddir)/config/icucross.mk autom4te.cache
|
||||
$(RMV) Makefile config/Makefile icudefs.mk $(LIBDIR) $(BINDIR)
|
||||
|
||||
check-local: $(top_builddir)/config/icu-config $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* common/icucfg.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
|
@ -21,6 +12,9 @@
|
|||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
|
@ -54,7 +48,7 @@
|
|||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Uncomment This to run Autoheader */
|
||||
/* wchar.h was found. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
|
@ -72,6 +66,9 @@
|
|||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of `void *', as computed by sizeof. */
|
||||
#undef SIZEOF_VOID_P
|
||||
|
||||
/* The size of `wchar_t', as computed by sizeof. */
|
||||
#undef SIZEOF_WCHAR_T
|
||||
|
||||
|
|
|
@ -37,6 +37,14 @@
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple things (presence of functions, etc) should just go in configure.in and be added to
|
||||
* icucfg.h via autoheader.
|
||||
*/
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "icucfg.h"
|
||||
#endif
|
||||
|
||||
/* Define _XOPEN_SOURCE for Solaris and friends. */
|
||||
/* NetBSD needs it to be >= 4 */
|
||||
#if !defined(_XOPEN_SOURCE)
|
||||
|
@ -270,15 +278,18 @@ uprv_getUTCtime()
|
|||
GetSystemTimeAsFileTime(&winTime.fileTime);
|
||||
return (UDate)((winTime.int64 - EPOCH_BIAS) / HECTONANOSECOND_PER_MILLISECOND);
|
||||
#else
|
||||
/*
|
||||
|
||||
#if defined(HAVE_GETTIMEOFDAY)
|
||||
struct timeval posixTime;
|
||||
gettimeofday(&posixTime, NULL);
|
||||
return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000));
|
||||
*/
|
||||
#else
|
||||
time_t epochtime;
|
||||
time(&epochtime);
|
||||
return (UDate)epochtime * U_MILLIS_PER_SECOND;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
@ -1967,10 +1978,6 @@ u_getVersion(UVersionInfo versionArray) {
|
|||
|
||||
#if U_ENABLE_DYLOAD
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "icucfg.h"
|
||||
#endif
|
||||
|
||||
#if defined(U_CHECK_DYLOAD)
|
||||
|
||||
#if defined(HAVE_DLOPEN)
|
||||
|
|
111
icu4c/source/configure
vendored
111
icu4c/source/configure
vendored
|
@ -6556,6 +6556,113 @@ done
|
|||
fi
|
||||
|
||||
|
||||
# Check for miscellanous functions.
|
||||
# These only go into common/icucfg.h and are NOT exported with ICU builds.
|
||||
# So, use for putil / tools only.
|
||||
# Note that this will generate HAVE_GETTIMEOFDAY, not U_HAVE_GETTIMEOFDAY
|
||||
# rerun 'autoheader' to regenerate icucfg.h.in
|
||||
|
||||
for ac_func in gettimeofday
|
||||
do
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
$as_echo_n "checking for $ac_func... " >&6; }
|
||||
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define $ac_func innocuous_$ac_func
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
#ifdef __STDC__
|
||||
# include <limits.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef $ac_func
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char $ac_func ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined __stub_$ac_func || defined __stub___$ac_func
|
||||
choke me
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return $ac_func ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext && {
|
||||
test "$cross_compiling" = yes ||
|
||||
$as_test_x conftest$ac_exeext
|
||||
}; then
|
||||
eval "$as_ac_var=yes"
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_var=no"
|
||||
fi
|
||||
|
||||
rm -rf conftest.dSYM
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
ac_res=`eval 'as_val=${'$as_ac_var'}
|
||||
$as_echo "$as_val"'`
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
as_val=`eval 'as_val=${'$as_ac_var'}
|
||||
$as_echo "$as_val"'`
|
||||
if test "x$as_val" = x""yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Check whether to use the evil rpath or not
|
||||
# Check whether --enable-rpath was given.
|
||||
if test "${enable_rpath+set}" = set; then
|
||||
|
@ -10141,7 +10248,6 @@ HAVE_UINT64_T=1
|
|||
fi
|
||||
|
||||
|
||||
#AC_DEFINE([HAVE_WCHAR_H], [], [Uncomment This to run Autoheader])
|
||||
# Do various wchar_t related checks
|
||||
if test "${ac_cv_header_wchar_h+set}" = set; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for wchar.h" >&5
|
||||
|
@ -10277,7 +10383,8 @@ then
|
|||
U_HAVE_WCHAR_H=0
|
||||
U_HAVE_WCSCPY=0
|
||||
else
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_WCHAR_H 1
|
||||
_ACEOF
|
||||
|
||||
|
|
|
@ -358,6 +358,13 @@ if test "$enabled" = "check"; then
|
|||
fi
|
||||
AC_SUBST(U_CHECK_DYLOAD)
|
||||
|
||||
# Check for miscellanous functions.
|
||||
# These only go into common/icucfg.h and are NOT exported with ICU builds.
|
||||
# So, use for putil / tools only.
|
||||
# Note that this will generate HAVE_GETTIMEOFDAY, not U_HAVE_GETTIMEOFDAY
|
||||
# rerun 'autoheader' to regenerate icucfg.h.in
|
||||
AC_CHECK_FUNCS([gettimeofday])
|
||||
|
||||
# Check whether to use the evil rpath or not
|
||||
AC_ARG_ENABLE(rpath,
|
||||
[ --enable-rpath use rpath when linking [default is only if necessary]],
|
||||
|
@ -896,7 +903,6 @@ HAVE_UINT64_T=1
|
|||
fi
|
||||
AC_SUBST(HAVE_UINT64_T)
|
||||
|
||||
#AC_DEFINE([HAVE_WCHAR_H], [], [Uncomment This to run Autoheader])
|
||||
# Do various wchar_t related checks
|
||||
AC_CHECK_HEADER(wchar.h)
|
||||
if test "$ac_cv_header_wchar_h" = no
|
||||
|
@ -904,7 +910,7 @@ then
|
|||
U_HAVE_WCHAR_H=0
|
||||
U_HAVE_WCSCPY=0
|
||||
else
|
||||
AC_DEFINE(HAVE_WCHAR_H)
|
||||
AC_DEFINE([HAVE_WCHAR_H], [1], [wchar.h was found.])
|
||||
U_HAVE_WCHAR_H=1
|
||||
# Some broken systems have wchar.h but not some of its functions...
|
||||
AC_SEARCH_LIBS(wcscpy, wcs w)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2008-2009, International Business Machines Corporation and others. All Rights Reserved.
|
||||
# Copyright (c) 2008-2010, International Business Machines Corporation and others. All Rights Reserved.
|
||||
#
|
||||
#
|
||||
# Makefile for regenerating configure in the face of a bad ^M
|
||||
|
@ -7,6 +7,11 @@
|
|||
# Usage: MAKE -f configure.mk configure
|
||||
|
||||
AUTOCONF=autoconf
|
||||
all: configure common/icucfg.h.in
|
||||
|
||||
common/icucfg.h.in: configure.in
|
||||
autoheader
|
||||
|
||||
configure: configure.in ./aclocal.m4
|
||||
( $(AUTOCONF) && mv configure configure.tmp && sed -e 's%^ac_cr=.*%ac_cr=`echo X |tr X "\\015"`%' < configure.tmp > configure && chmod a+rx $@ && rm configure.tmp ) || ( rm $@ ; "echo configure build failed" ; /usr/bin/false )
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ static UOption options[]={
|
|||
/*2*/ UOPTION_DEF("interactive", 'i', UOPT_NO_ARG),
|
||||
/*3*/ UOPTION_VERBOSE,
|
||||
/*4*/ UOPTION_DEF("list-plugins", 'L', UOPT_NO_ARG),
|
||||
/*5*/ UOPTION_DEF("milisecond-time", 'm', UOPT_NO_ARG),
|
||||
};
|
||||
|
||||
|
||||
|
@ -245,6 +246,8 @@ cmd_help()
|
|||
#endif
|
||||
*/
|
||||
fprintf(stderr, "No help available yet, sorry. \n");
|
||||
fprintf(stderr, "\t -m\n"
|
||||
"\t --millisecond-time - Print the current UTC time in milliseconds.\n");
|
||||
}
|
||||
|
||||
const char *prettyDir(const char *d)
|
||||
|
@ -254,6 +257,11 @@ const char *prettyDir(const char *d)
|
|||
return d;
|
||||
}
|
||||
|
||||
void cmd_millis()
|
||||
{
|
||||
printf("Milliseconds since Epoch: %.0f\n", uprv_getUTCtime());
|
||||
}
|
||||
|
||||
void cmd_version(UBool noLoad)
|
||||
{
|
||||
UVersionInfo icu;
|
||||
|
@ -671,6 +679,9 @@ main(int argc, char* argv[]) {
|
|||
|
||||
if(options[2].doesOccur) {
|
||||
doInteractive();
|
||||
} else if(options[5].doesOccur) {
|
||||
cmd_millis();
|
||||
didSomething=TRUE;
|
||||
} else {
|
||||
if(options[3].doesOccur) {
|
||||
cmd_version(FALSE);
|
||||
|
|
Loading…
Add table
Reference in a new issue