Форум — Development Как узнать количество миллисекунд, прошедших от начала эпохи (00:00 01.01.1970) до начала текущего дня. 0 0 Сабж Ссылка
Ответ на: комментарий от anonymous 05.10.04 20:09:00 MSK На СИ! anonymous (05.10.04 20:12:54 MSK) Показать ответ Ссылка
Ответ на: комментарий от anonymous 05.10.04 20:12:54 MSK Соси! А это по твоему на чем! anonymous (05.10.04 20:24:47 MSK) Ссылка
Ответ на: комментарий от anonymous 05.10.04 20:09:00 MSK > man 2 time Дык оно ж в секундах. :) watashiwa_daredeska ★★★★ (05.10.04 20:29:49 MSK) Ссылка
struct timeval { __time_t tv_sec; /* Seconds */ __suseconds_t tv_usec; /* Microseconds */ }; Есть такая структура. Ее используют следующим образом: #include <sys/time.h> #include <stdio.h> int main() { struct timeval tv; if (gettimeofday(&tv) == -1) return (1); printf("%d seconds, %d microseconds since 1 jan 1970\n", (unsigned long)tv.tv_sec, (unsigned long)tv.tv_usec); return (0); } ay49Mihas (05.10.04 21:59:56 MSK) Ссылка
#include <time.h> #include <string.h> int main(int argc, char **argv) { time_t now = time(NULL), dayStart; struct tm nowStruct = gmtime(&now), dayStartStruct; memcpy(&dayStart, &now, sizeof(struct tm)); dayStart.tm_hour = 0; dayStart.tm_min = 0; dayStart.tm_sec = 1; dayStart = mktime(&dayStartStruct); return(now - dayStart); } anonymous (05.10.04 22:43:04 MSK) Показать ответ Ссылка
Ответ на: комментарий от anonymous 05.10.04 22:43:04 MSK очень извеняюсь, ошибочка вышла.. #include <time.h> #include <string.h> int main(int argc, char **argv) { time_t now = time(NULL), dayStart; struct tm nowStruct = gmtime(&now), dayStartStruct; memcpy(&dayStartStruct, &nowStruct, sizeof(struct tm)); dayStartStruct.tm_hour = 0; dayStartStruct.tm_min = 0; dayStartStruct.tm_sec = 1; dayStart = mktime(&dayStartStruct); return(now - dayStart); } anonymous (05.10.04 22:47:34 MSK) Показать ответ Ссылка
Ответ на: комментарий от anonymous 05.10.04 22:47:34 MSK Мне кажется на Perl проще и быстрее anonymous (06.10.04 13:00:09 MSK) Показать ответ Ссылка
Ответ на: комментарий от anonymous 06.10.04 13:00:09 MSK >Мне кажется на Perl проще и быстрее Проще и быстрее чем вызов gettimeofday() ?? mky ★★★★★ (06.10.04 22:18:00 MSK) Ссылка