vala:这是以毫秒为单位获取当前时间的正确方法吗?(vala: is this the correct way to get the current time in milliseconds ?)
与Vala一起使用这个库:
http://valadoc.org/#!api=glib-2.0/GLib.DateTime
GLib.DateTime now = new GLib.DateTime.now_local(); var sec = now.to_unix() var msec = (sec * 1000) + now.get_microsecond();
这是以毫秒为单位获取当前时间的正确方法吗?
有没有更好的办法 ?
Using this library with Vala :
http://valadoc.org/#!api=glib-2.0/GLib.DateTime
GLib.DateTime now = new GLib.DateTime.now_local(); var sec = now.to_unix() var msec = (sec * 1000) + now.get_microsecond();
is this the correct way to get the current time in millisecond ?
is there a better way ?
原文:https://stackoverflow.com/questions/19467849
最满意答案
好的,最后我自己得到了答案......
我们在这个问题上遇到的第一件事是在执行模拟器时得到以下警告。
警告:SD卡文件必须至少为9MB,忽略/ dev / sdX
跟踪main.c中的源代码后,
if (size < 9*1024*1024ULL) { fprintf(stderr, "### WARNING: SD Card files must be at least 9MB, ignoring '%s'\n", opts->sdcard); } else { hw->hw_sdCard_path = ASTRDUP(opts->sdcard); }
我忽略了if条件,即强制执行hw-> hw_sdCard_path = ASTRDUP(opts-> sdcard);
一切顺利:)
OK, finally I got the answer by myself...
first thing we occured in this issue is got below warning when execute emulator.
WARNING: SD Card files must be at least 9MB, ignoring /dev/sdX
after traced the source code in main.c,
if (size < 9*1024*1024ULL) { fprintf(stderr, "### WARNING: SD Card files must be at least 9MB, ignoring '%s'\n", opts->sdcard); } else { hw->hw_sdCard_path = ASTRDUP(opts->sdcard); }
I ignored the if condition, i.e. force execute hw->hw_sdCard_path = ASTRDUP(opts->sdcard);
then, everything go right:)
相关问答
更多-
SD卡(外部存储) 可移动存储不是外部存储 。 我在清单文件中添加了权限 这些权限与可移动存储无关。 我收到了这个错误 您没有直接文件系统访问可移动存储上的任意位置。 你知道如何允许访问EXTERNAL SD CARD吗? 或者: 在Android 4.4+上,在Android 4.4+上使用getExternalFilesDirs() , getExternalCacheDirs()和/或getExternalMediaDirs() (注意方法名称的复数形式),以便在可移动存储上访问应用程序的唯一目录。 ...
-
问题在于启动模拟器时的命令行参数 〜/ sdcard256m.img 我不得不扩展“ 〜 ”并将其更改为 /home/username/sdcard256m.img 在模拟器中检测到SD卡,我能够通过DDMS文件资源管理器推送文件。 The problem was with the command line parameter while launching the Emulator ~/sdcard256m.img I had to expand "~" and changed it to /home/u ...
-
在avd目录中,它位于以下位置: 视窗: %USERPROFILE%.android \ AVD \
有一个名为sdcard.img的文件。 你可以用新的图像文件替换它。 你可以在android-sdk / tools中使用mksdcard创建一个新的SD卡图像文件 用法:mksdcard [-l label] In the avd directory, which is in the following location: Windows: %use ... -
相机可以将图像(或缓存图像)保存在SD卡中。 如果您想测试相机是否需要SD卡(通常不需要),请删除SD卡选项。 否则,我认为你可以通过以下方式尝试创建新的SD卡: 按Or create new image 输入150MB用于新SD卡 好的,再试一次。 Camera may save image (or cached image) in SDcard. If you want to test Camera needs SDcard or not (normally not), remove the SDCar ...
-
如何在Android模拟器中破解真正的SD卡?(how to hack a real SD card in android emulator? (via USB card reader))[2022-01-18]
好的,最后我自己得到了答案...... 我们在这个问题上遇到的第一件事是在执行模拟器时得到以下警告。 警告:SD卡文件必须至少为9MB,忽略/ dev / sdX 跟踪main.c中的源代码后, if (size < 9*1024*1024ULL) { fprintf(stderr, "### WARNING: SD Card files must be at least 9MB, ignoring '%s'\n", opts->sdcard); } else { ... -
您可以在创建AVD时指定SD卡。 或者,您可以在Eclipse运行配置 - 目标选项卡 - 其他仿真器命令行选项中指定-sdcard选项。 http://developer.android.com/guide/developing/tools/emulator.html#sdcard You can specify SD card when creating AVD. Or you can specify -sdcard option in Eclipse Run Configuration - Targe ...
-
转到SD卡(Move to SD Card)[2023-01-06]
你在Eclipse中构建? 您需要在清单文件中设置目标SDK版本(如您引用的帖子所示),还需要在Eclipse的Project设置中进行设置。 在主菜单上,转到项目 - >属性 选择Android页面 选中您要构建的目标SDK旁边的框 您应该在Package Explorer中看到正确的Android版本作为库。 我在“src”和“gen”文件夹下面列为“Android2.2”。 Are you building within Eclipse? You need to set the target SDK ... -
请粘贴您的清单以及访问SDCard,您必须使用Environment.getExternalStorageDirectory()因为/mnt/sdcard/将是一个硬编码的解决方案,可能无法在某些设备或Android构建上工作。 Please paste your manifest and also for accessing the SDCard you must use Environment.getExternalStorageDirectory() since /mnt/sdcard/ would ...
-
首先,尝试使SD卡更大 - 例如,100 MB - 并重新启动模拟器。 硬件部分IIRC中的布尔值触发应用程序的APK - 内部存储器或SD卡的首选位置。 一个9MB的APK并不罕见。 First, try making the SD card larger - like, 100 MB - and restarting the emulator. The boolean in the hardware section, IIRC, triggers the preferred location for t ...
-
这在仿真器文档中有介绍 。 模拟的SD卡映像是模拟器读取和写入的单个文件。 您可以指定在使用android GUI创建Android虚拟设备(AVD)时创建SD卡(例如,在Eclipse中通过单击 按钮): 或者您可以使用mksdcard命令创建一个SD卡。 要在启动模拟器时使用SD卡映像,请将-sdcard选项传递给emulator命令: emulator -sdcard c:/path/to/my/sdcard 如果您使用android GUI启动仿真器,则需要在创建AVD时指定SD卡。 This i ...