File tree Expand file tree Collapse file tree 4 files changed +28
-16
lines changed Expand file tree Collapse file tree 4 files changed +28
-16
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ target_link_libraries(stream_local whisper ${SDL2_LIBRARIES})
53
53
add_executable (whisper_http_server_base_httplib whisper_http_server_base_httplib.cpp common/common.cpp httplib/httplib.h nlohmann/json.hpp handler/inference_handler.cpp params/whisper_params.cpp )
54
54
target_link_libraries (whisper_http_server_base_httplib whisper )
55
55
56
- add_executable (whisper_server_base_on_uwebsockets whisper_server_base_on_uwebsockets.cpp stream/stream_components_service.cpp )
56
+ add_executable (whisper_server_base_on_uwebsockets whisper_server_base_on_uwebsockets.cpp stream/stream_components_service.cpp utils/utils.cpp )
57
57
#添加头文件
58
58
target_include_directories (whisper_server_base_on_uwebsockets PRIVATE ${UWEBSOCKETS_INCLUDE_DIRS} )
59
59
# 链接 uWebSockets、zlib、libuv 和 uSockets 库
Original file line number Diff line number Diff line change
1
+ //
2
+ // Created by Ping Lee on 2023/11/21.
3
+ //
4
+
5
+ #include " utils.h"
6
+ #include < string>
7
+ #include < sstream>
8
+ #include < iomanip>
9
+
10
+ std::string get_current_time () {
11
+ auto now = std::chrono::system_clock::now ();
12
+ auto now_c = std::chrono::system_clock::to_time_t (now);
13
+ auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch ()) % 1000 ;
14
+
15
+ std::stringstream current_time_ss;
16
+ current_time_ss << std::put_time (std::localtime (&now_c), " %y-%m-%d %H:%M:%S" )
17
+ << ' .' << std::setfill (' 0' ) << std::setw (3 ) << milliseconds.count ();
18
+
19
+ std::string current_time = current_time_ss.str ();
20
+ return current_time;
21
+ }
Original file line number Diff line number Diff line change
1
+ #pragma once
2
+
3
+ #include < iostream>
4
+
5
+ std::string get_current_time ();
Original file line number Diff line number Diff line change 1
1
#include " nlohmann/json.hpp"
2
- #include " stream/stream_components_params.h"
3
2
#include " stream/stream_components_service.h"
4
3
#include " stream/stream_components.h"
5
-
4
+ # include " utils/utils.h "
6
5
#include < uwebsockets/App.h>
7
6
#include < iostream>
8
7
#include < string>
11
10
12
11
using namespace stream_components ;
13
12
14
- std::string get_current_time () {
15
- auto now = std::chrono::system_clock::now ();
16
- auto now_c = std::chrono::system_clock::to_time_t (now);
17
- auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch ()) % 1000 ;
18
-
19
- std::stringstream current_time_ss;
20
- current_time_ss << std::put_time (std::localtime (&now_c), " %y-%m-%d %H:%M:%S" )
21
- << ' .' << std::setfill (' 0' ) << std::setw (3 ) << milliseconds.count ();
22
-
23
- std::string current_time = current_time_ss.str ();
24
- return current_time;
25
- }
26
-
27
13
int main (int argc, char **argv) {
28
14
// Read parameters...
29
15
whisper_local_stream_params params;
You can’t perform that action at this time.
0 commit comments