Time zone lossless switching and real-time verification method and application thereof
By introducing time zone management middleware into the embedded slide scanner and adopting a two-stage mode of parallel verification in an isolated temporary environment and atomic update of the global time zone context, the problems of business interruption and incomplete verification during time zone switching are solved, achieving lossless switching and real-time verification, and ensuring the time consistency and auditability of medical data.
Patent Information
- Application Number
- CN202610499642.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-16
- Publication Date
- 2026-05-15
- Estimated Expiration
- 2046-04-16
AI Technical Summary
Existing embedded slide scanners cannot achieve dynamic and safe switching during time zone switching and lack real-time automated verification, making it difficult to guarantee the time consistency and auditability of medical data, thus limiting the reliability of global deployment and clinical application of the equipment.
By introducing a time zone management middleware, a two-stage model of isolated temporary environment parallel verification and global time zone context atomic update is adopted to achieve lossless switching and real-time verification, including building a temporary time zone environment, parallel verification, and atomic time zone switching operations, ensuring that core business is not interrupted.
It enables dynamic and secure switching of time zones without interrupting core scanning tasks, and ensures the time consistency and auditability of medical data through real-time automated verification, thereby improving the availability of equipment and the efficiency of global deployment.
Smart Images

Figure CN122045071A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital pathology medical equipment technology, and in particular to a method for non-destructive time zone switching and real-time verification for an embedded slide scanner and its application. Background Technology
[0002] With the rapid development of digital pathology technology, embedded slide scanners based on the Linux operating system have been widely used in the global medical field. The control software of this device not only undertakes the core tasks of high-precision motion platform control and optical imaging system regulation, but also generates timestamped digital pathology image files, device operation logs, and audit records. The accuracy of time zone configuration directly determines the standardization of image file naming and the effectiveness of medical data traceability. It also affects the compliance and consistency of time synchronization between the device and hospital information systems and laboratory information systems, making it a key technical point for the global deployment and reliable clinical application of embedded slide scanners.
[0003] Currently, there are three main technical solutions for time zone management in embedded slide scanners, and each solution has significant technical defects, making it difficult to meet the requirements of high availability of medical devices and compliance of medical data. Firstly, there's the static configuration and manual switching solution. The device's time zone is fixed at the factory or during on-site installation. Subsequent changes require professional engineers to manually operate via command line or a simple interface, and this operation must be performed when the device is idle. After switching, the effect is only confirmed by manually checking logs, lacking a systematic verification process, resulting in low operational efficiency and the potential for overlooking problems. Secondly, there's the solution relying on the operating system's native mechanisms. The scanner control software directly calls system functions to obtain the local time, making time zone switching a global, instantaneous operation. Functional modules within the software, such as the task scheduler, file storage module, and log service, will perceive the new time zone configuration at different times, leading to short-term inconsistencies in the software's internal state and easily causing chaos in the scanning task timeline. Thirdly, there's a lack of targeted automated verification solutions. Existing equipment testing focuses on core functions such as image quality and scanning speed, with insufficient coverage of edge scenario testing for time zone switching. Even when relevant tests are conducted, they only involve manually changing the time zone and restarting the service or performing simple operations, failing to simulate time zone switching scenarios under continuous scanning workloads, and even less able to perform real-time, lossless integrity verification of the software's internal state at the moment of switching.
[0004] In summary, existing technologies cannot achieve dynamic and secure time zone switching without interrupting the core scanning task of embedded slide scanners. They also cannot automatically and comprehensively verify the correctness of all time-related functions of the software during the switching process. This makes it difficult to guarantee the time consistency and auditability of medical data, thus limiting the efficiency of global deployment of embedded slide scanners and the reliability of clinical applications. Summary of the Invention
[0005] This invention provides a method for non-destructive time zone switching and real-time verification for embedded slide scanners and its application. It addresses the problems of existing technologies that cannot achieve dynamic and secure time zone switching without interrupting the core business of embedded slide scanners, and also lack an automatic real-time verification mechanism for software time consistency and functional correctness during the switching process, making it difficult to ensure the high availability and auditability of medical data.
[0006] The core technology of this invention is to introduce a time zone management middleware into the control software and adopt a two-stage mode of "parallel verification of isolated temporary environment" and "atomic update of global time zone context" to achieve lossless hot switching of time zone and real-time status verification of core business without interruption.
[0007] In a first aspect, the present invention provides a method for non-destructive time zone switching and real-time verification for an embedded slide scanner, the method comprising the following steps:
[0008] Receive a request to switch to the target time zone; Without interrupting the continuous operation of the core business of the embedded slide scanner, a temporary time zone environment isolated from the current operating environment is constructed, and the target time zone configuration is simulated and loaded in the temporary time zone environment; Start a parallel verification thread to perform parallel verification of time-related interfaces and business logic within the software based on a temporary time zone environment; The determination will be based on the verification results: If all verification items pass, then an atomic time zone switching operation is performed, so that the software's runtime environment is globally aware of the target time zone configuration. If verification fails, the switching process will be aborted and the original time zone configuration will be maintained.
[0009] Furthermore, a temporary timezone environment isolated from the current operating environment is constructed, including: By configuring a thread-local target timezone environment variable and calling the timezone setting function, a temporary environment that applies only to the verification thread can be constructed; or, Create an independent temporary time zone environment context in memory, or build an independent temporary configuration directory in local storage, and load the configuration file of the target time zone to achieve data and input / output isolation from the current backbone business operating environment.
[0010] Furthermore, the time-related interfaces and business logic within the software are verified in parallel, including the following verification steps: System interface verification: In a temporary time zone environment, call the standard library functions related to time conversion and compare the function execution results with the expected results calculated based on the current time zone and Coordinated Universal Time; Business logic sampling verification: Call the key business function interface of the scanning control software to check whether the time-related outputs generated in the temporary time zone environment conform to the preset time logic rules; State consistency check: Check the software's internal time-related global state variables or cached data to verify that their timestamp data is stored in a unified Coordinated Universal Time (UTC) standard.
[0011] Furthermore, the specific content of business logic sampling verification should include at least one of the following: Intercept the function return data of the simulated scanned image file name and compare the timestamp part to see if it matches the expectation; Verify the accuracy of the calculated trigger time for the next scheduled scan task; The generated standard format log entries are output to an isolated memory buffer and their time recording compliance is verified.
[0012] Furthermore, the atomic time zone switching operation is performed, specifically including: Acquire a global lock to protect the global shared timezone context, blocking other business threads from adding time read requests; Within the critical section after acquiring the global lock, the global shared time zone context is updated to the target time zone configuration through a single indivisible operation, or the global atomic pointer is replaced with a new pointer pointing to the target time zone configuration; Release the global lock and send a synchronization notification to cause all modules to automatically reload the target time zone configuration on the next time call.
[0013] Furthermore, another way to implement atomic time zone switching operations is as follows: Maintain a version number mechanism for time zone configurations, and generate the latest version number of the configuration bound to the target time zone; or, The message bus broadcasts a switching activation event with a synchronization token to each business module, enabling each business module to atomically switch its runtime configuration to the target time zone at the same logical point in time after receiving the event.
[0014] Secondly, this invention provides a time zone lossless switching and real-time verification system, including a time zone management middleware deployed as a resident service module. The time zone management middleware specifically includes: The request receiving module is used to listen for and receive requests to switch to the target time zone; The environment simulation module is used to build a temporary time zone environment isolated from the current operating environment without interrupting the operation of core business, and to load the target time zone configuration into it; The verification engine module is used to start parallel verification threads to perform parallel verification of software time-related interfaces and business logic based on a temporary time zone environment. The atomic switching execution module is used to synchronize the target time zone configuration to the entire software runtime environment in an atomic manner when all verification items pass; and to abort the switching process when verification fails, so as to keep the core scanning task of the embedded slide scanner running continuously.
[0015] Furthermore, it also includes scanning software business modules that are monitored and scheduled by the time zone management middleware; The scanning software business module includes at least an optical imaging control module, a log module, and a task scheduling module; all hardware driver layers and business layers within the scanning software business module obtain timestamps based on the currently effective time zone configuration through the unified time service interface provided by the time zone management middleware.
[0016] Thirdly, the present invention provides an embedded slide scanner, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-mentioned lossless time zone switching and real-time verification method.
[0017] Fourthly, the present invention provides a readable storage medium storing a computer program, the computer program including program code for controlling a process to execute the process, the process including the lossless time zone switching and real-time verification method described above.
[0018] The main contributions and innovations of this invention are as follows: 1. Achieve seamless switching of core business without interruption: Core scanning tasks can be completed without interruption throughout the entire time zone switching and verification process, ensuring the high availability and efficiency of the embedded slide scanner.
[0019] 2. Improve the reliability and security of time zone switching: Through a two-stage "verification first" approach, potential risks are identified and intercepted before the new time zone configuration takes effect, avoiding medical data chaos or equipment system instability.
[0020] 3. Real-time automated verification of time zone switching: The traditional time-consuming and error-prone manual verification is transformed into an automatic real-time inspection process built into the software, which greatly improves the timeliness and comprehensiveness of verification.
[0021] 4. Improve the efficiency of global equipment deployment and maintenance: Support remote and secure dynamic time zone configuration, reducing the cost and operational complexity of on-site technical support for equipment.
[0022] 5. Optimize the decoupling and maintainability of the software architecture: By introducing middleware, the system-level function of time zone switching is decoupled from the core scanning business logic, making the software architecture clearer.
[0023] 6. Ensure the time consistency and auditability of medical data: Ensure that all software modules perceive the new time zone configuration at the same point in time (atomic level), completely avoid timestamp chaos, and meet the strict traceability requirements of the medical industry.
[0024] Details of one or more embodiments of the present invention are set forth in the following drawings and description, so that other features, objects and advantages of the invention will be more readily understood. Attached Figure Description
[0025] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is an overall structural diagram of the system according to an embodiment of the present invention; Figure 2 This is a flowchart of a time zone non-destructive switching and real-time verification method for an embedded slide scanner according to an embodiment of the present invention; Figure 3 This is a detailed flowchart of the parallel verification thread according to an embodiment of the present invention; Figure 4 This is a timing diagram of the atomic switching mechanism according to an embodiment of the present invention; Figure 5 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0026] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0027] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.
[0028] This invention relates to a method for non-destructive time zone switching and real-time verification for embedded slide scanners and its application, applicable to embedded slide scanners based on the Linux operating system. The scanner comprises a scanner hardware unit and control software. The scanner hardware unit is configured with a high-precision motion platform, an optical imaging system, and various hardware driver layers, including at least camera imaging drivers and motor control drivers. The control software undertakes the core tasks of controlling the high-precision motion platform and regulating the optical imaging system, while simultaneously generating timestamped digital pathological image files, equipment operation logs, and audit records. This invention, by deploying a time zone management middleware at the control software layer, constructs a two-stage "verification-effectiveness" time zone switching mode, achieving uninterrupted dynamic time zone switching for core scanning operations, while simultaneously completing real-time automated verification of the switching process. The following is in conjunction with the appendix... Figure 1 To be continued Figure 4 The preferred embodiments of the present invention will be described in detail below. Those skilled in the art can implement the technical solutions of the present invention based on the following description without departing from the technical concept of the present invention.
[0029] The core implementation logic of this invention is as follows: Time zone management middleware uniformly takes over time zone switching requests, constructs a temporary time zone environment in a space completely isolated from the scanner's current operating environment, and simulates the system behavior of the target time zone; parallel verification threads perform multi-dimensional verification of time-related system interfaces, scanner-specific business logic, and internal time states; only when all verifications pass, the target time zone configuration is synchronized to the global operating environment using atomic operations, enabling all functional modules of the control software to uniformly perceive the new time zone; if verification fails, the switching process is immediately terminated, the original time zone configuration is maintained, and the temporary time zone environment is cleaned up. Throughout the entire process, the scanner's core scanning business continues to run without interruption or pause.
[0030] Example 1: Specific Implementation of System Architecture The time zone lossless switching and real-time verification system of this invention is deployed in the control software layer of an embedded slide scanner. The overall system architecture is shown in the attached figure. Figure 1 As shown, it mainly includes a time zone switching request interface, a time zone management middleware, an atomic switching executor, and a scanning software business module. The time zone management middleware is the core module of the system, with a built-in temporary environment manager and verification engine. The scanning software business module includes at least an imaging module, a logging module, and a task scheduling module. The modules share a time zone context component to achieve unified acquisition of time information. Moreover, the core scanning business is executed independently and continuously by the scanning software business module, without being interfered with by the operation of the time zone management middleware.
[0031] The time zone switching request interface is used to receive time zone switching requests from the user interface, network configuration interface, or device management system. The request carries the configuration information of the target time zone. The Temporary Environment Manager is a core submodule of the time zone management middleware. It is responsible for building a temporary time zone environment that is isolated from the current running environment based on the target time zone configuration information. This temporary time zone environment can completely simulate the system behavior after the target time zone takes effect. The verification engine is used to start parallel verification threads, perform multi-dimensional verification operations, and output verification results; The atomic switching actuator is used to perform atomic time zone switching operations after verification, synchronizing the target time zone configuration to the global runtime environment of the scanner control software; The scanning software business module, as the monitored object, maintains the normal operation of the core scanning business throughout the process, and only obtains the updated time zone configuration through the shared time zone context component during the atomic switching phase.
[0032] Example 2: Overall Flow Implementation of a Lossless Time Zone Switching and Real-Time Verification Method The overall process of the method of the present invention is as follows: Figure 2 As shown, the specific execution steps are as follows: 1. Receive time zone switching requests: The time zone switching request interface listens for external time zone switching commands in real time. When it receives a request carrying the target time zone configuration information, it forwards the request to the time zone management middleware. 2. Constructing an isolated temporary time zone environment: After receiving the target time zone configuration information, the temporary environment manager of the time zone management middleware constructs a temporary time zone environment in a space isolated from the scanner's current operating environment. During this process, the core scanning business continues to run without any impact. 3. Start parallel verification thread: The verification engine of the time zone management middleware starts an independent parallel verification thread, using the temporary time zone environment as the verification basis, and performs multi-dimensional verification on the time-related functions of the scanner control software; 4. Verification Result Judgment: The verification engine aggregates the verification results of parallel verification threads and performs consistency and validity judgments; 4.1. If verification fails, the verification engine immediately stops the entire time zone switching process, sends the verification failure result and specific reason back to the time zone switching request source, the temporary environment manager cleans up the built temporary time zone environment, the scanner control software maintains the original time zone configuration, and the core scanning business continues to operate normally. 4.2. If the verification passes, the time zone management middleware calls the atomic switching executor to perform the atomic time zone switching operation; 4.2.1 Completion of the switching process: After the atomic time zone switching operation is completed, all functional modules of the scanner control software uniformly perceive the new time zone configuration. The time zone management middleware sends the switching success result back to the time zone switching request source. The temporary environment manager cleans up the temporary time zone environment. The entire time zone switching and verification process is completed, and the core scanning business is uninterrupted throughout.
[0033] In this embodiment, the present invention constructs a temporary time zone environment in a Linux embedded environment. It relies on an in-process resource isolation mechanism and does not employ full container technology. Based on the resource configuration of the embedded slide scanner, it employs two methods: lightweight construction and enhanced construction. Both methods achieve complete isolation from the current operating environment without affecting the core scanning operations. The specific implementation is as follows: 1. Lightweight build method Suitable for resource-constrained Linux embedded operating environments, it achieves isolation through thread-local storage and runtime behavior of C library functions. In the verification thread, the thread-local TZ environment variable is set using the setenv("TZ", "Target / TimeZone", 1) function, and then the tzset() function is called to load the target time zone configuration into the time zone library of the verification thread. This target time zone configuration only applies to the verification thread. The scanner's main business thread and other threads that have not set the TZ environment variable still use the system's default / etc / localtime link or global time zone setting, and are not affected by the verification thread.
[0034] 2. Enhanced Construction Method Suitable for Linux embedded runtime environments with more abundant computing resources, it achieves complete memory-level isolation from the file system; by using the fopen and read functions, the time zone file corresponding to the target time zone (such as / usr / share / zoneinfo / America / New_York) is loaded into the memory buffer, and then the time zone related functions are directly parsed from the memory buffer by the tzload() internal function or the custom fopen_memstream routine, without reading any time zone configuration from the local file system, thus achieving complete isolation from the current runtime environment.
[0035] Both of the above construction methods are executed by the temporary environment manager of the time zone management middleware. The temporary time zone environment is built when the parallel verification thread starts and destroyed when the verification process ends, without occupying the scanner's long-term system resources.
[0036] In this embodiment, as Figure 3 As shown, the parallel verification process includes the parallel verification thread started by the verification engine, which sequentially performs three verification tasks: system interface verification, business logic sampling verification, and state consistency check. All verification operations are completed within a temporary time zone environment and adopt an I / O isolation mechanism to avoid polluting the scanner's real business data. The specific verification content and implementation method are as follows: 1. System Interface Verification: In a temporary timezone environment, call time-related standard library functions, including at least the local time conversion function `localtime` and the time formatting function `strftime`, and obtain the actual execution results of the functions; at the same time, calculate the expected execution results of the above functions based on the current Coordinated Universal Time (UTC) and the timezone rules of the target timezone; compare the actual execution results with the expected execution results one by one to confirm the normal functioning of the system time interface. If the comparison results are consistent, the system interface verification passes; otherwise, the verification fails.
[0037] 2. Business Logic Sampling Verification: Call the key business function interface of the scanner control software to execute at least one business logic operation, including simulating the generation of scanned image file names, calculating the trigger time of the next scheduled scan task, and generating standard format log entries; check whether the time-related outputs generated by the above business logic operations in the temporary time zone environment conform to the preset rules and are without anomalies. If all outputs conform to the preset rules, the business logic sampling verification passes; otherwise, the verification fails.
[0038] 3. State Consistency Check: Scan and inspect the time-related global state variables, cached data, and task queues within the scanner control software to verify whether the design of the global time state variables supports smooth time zone transition and confirm whether the timestamps in the task queue are stored in Coordinated Universal Time (UTC). If the above all meet the requirements for smooth time zone transition, the state consistency check passes; otherwise, the verification fails.
[0039] After the parallel verification thread completes the above three verification tasks, it summarizes the results of each verification item to the verification engine. The verification engine only determines that the overall verification is passed if all three verifications pass, and determines that the overall verification fails if any one verification fails.
[0040] In this embodiment, to avoid contaminating the scanner's real business data during the parallel verification process, the present invention employs a dedicated I / O isolation mechanism during the verification process in a temporary time zone environment. This mechanism isolates and protects operations involving data reading and writing, such as log generation, file naming, and cache checking, ensuring that all verification behaviors are "side-effect-free" queries and calculations. The specific implementation is as follows: 1. I / O isolation for log verification: During the initialization of the parallel verification thread, the function pointer of the log service is temporarily replaced, or a simulated logger is passed to the verification thread through dependency injection; all operations that call the log generation function in the verification thread write the log content to a circular buffer in memory or a dedicated virtual file descriptor, rather than the scanner's real log file or network socket; after verification, the verification engine only analyzes the log content in the buffer and compares it with the expected result. After the comparison is completed, the buffer is released immediately without retaining any log data.
[0041] 2. I / O isolation for file naming: When the business function that generates the file name of the scanned image is called, only the time calculation and string generation logic inside the function are executed. The file name string returned by the function is intercepted and compared with the expected file name. During this process, no file system creation or writing interface is called, and no image file is actually generated or created. By decoupling "file name generation" from "file system I / O operation", file naming verification is achieved without side effects.
[0042] 3. I / O isolation for cached data inspection: For read-only global caches (such as time zone information caches), the verification thread directly reads the data safely through a thread-safe interface without performing any write operations; for business caches that may be modified by core business processes, the verification thread first obtains a read-only snapshot of the cache during inspection, and then performs status checks based on the snapshot, without directly accessing the actual business cache, thus avoiding interference with the cached data of the core scanning business.
[0043] In this embodiment, as Figure 4 As shown, the core objective of atomic time zone switching is to ensure that all modules and threads of the scanner control software perceive the new time zone configuration at the same time within a very short time window, avoiding inconsistencies in the perceived time zone time among different modules. This invention achieves atomic switching through two methods: protecting the time zone context with a read-write lock or replacing the time zone context with an atomic pointer. The two methods can be flexibly selected according to the hardware resource configuration of the embedded slide scanner. The specific implementation is as follows: 1. Atomic switching implementation based on read-write lock (RWLock) 1.1. During normal operation, all business threads of the scanner control software perform read operations through the shared time zone context component when acquiring time information, and all read operations hold read locks. Multiple business threads can perform read operations concurrently without affecting the operation of core scanning business. 1.2. Once the verification is successful, the atomic switching executor of the timezone management middleware initiates a write operation request to the shared timezone context component, requesting to acquire an exclusive write lock; this write lock will block all new read requests and wait for all existing read operations to complete. 1.3. After the atomic switching executor acquires the write lock, it completes the update of all fields of the shared time zone context within a very short critical section. The updated content includes at least the time zone identifier, time zone rule pointer, and UTC offset. 1.4. After the fields of the shared time zone context are updated, the atomic switch executor immediately releases the write lock. Thereafter, all business threads' read requests will obtain the updated time zone configuration, enabling all modules to have a unified awareness of the new time zone.
[0044] 2. Implementation of Atomic Switching Based on Atomic Pointers 2.1. Encapsulate the shared timezone context as an independent structure, and the scanner control software uses a global atomic pointer (such as std::atomic) to handle this. <TimezoneContext >) This structure is referenced, and all business threads read the timezone configuration through this atomic pointer; 2.2. Once the verification is successful, the atomic switching executor prepares a brand new timezone context structure instance in the background, which has completed all the configurations for the target timezone; 2.3. The atomic switching executor atomically replaces the value of the global atomic pointer from pointing to the old time zone context structure to pointing to the new time zone context structure through a hardware-guaranteed atomic comparison and swap operation. This operation is indivisible and has no intermediate state. 2.4. After the atomic pointer is replaced, any business thread that reads through the pointer will read the new time zone configuration. Threads that are reading the old configuration will either read the old time zone context completely or read the new time zone context completely. There will be no intermediate state of inconsistent reading.
[0045] Regardless of the implementation method used, the atomic time zone switching operation is completed within a microsecond-level time window. After completion, a synchronization notification is sent to all business modules through the shared time zone context component. Upon receiving the notification, each business module synchronously refreshes its local time zone cache to ensure that all subsequent time acquisition requests are based on the new time zone configuration.
[0046] In this embodiment, to achieve hardware-software collaborative time zone management and ensure the time consistency of the hardware layer and the time continuity of image capture and stitching during time zone switching, this invention designs a unified time service interface and a high-precision UTC hardware timestamp generation mechanism for the scanner's hardware driver layer, specifically implemented as follows: 1. Unified Time Acquisition in Hardware Driver Layer: All hardware driver layers of the scanner, including camera imaging driver and motor control driver, do not directly call the local time function of the Linux system. Instead, they obtain the timestamp through the unified time service interface provided by the time zone management middleware. This unified time service interface maintains an atomic clock source based on the system UTC clock. At the moment of atomic time zone switching, this clock source atomically switches the time zone configuration associated with the time base, ensuring that the time obtained by the hardware driver layer is always a consistent local time based on the current effective time zone configuration.
[0047] 2. Ensuring the temporal continuity of image capture and stitching: When the scanner performs continuous scanning tasks (such as line scanning and area scanning), the camera hardware or camera imaging driver of the optical imaging system will add a high-precision hardware timestamp at the moment of capturing each frame or each line of image. This timestamp is generated based on Coordinated Universal Time (UTC) and is a monotonically increasing microsecond count value from the start of scanning, remaining continuous, uninterrupted, and without jumps before and after time zone switching. In subsequent image stitching, file naming, and log recording stages, the scanner control software only uses this UTC hardware timestamp as the time reference and combines it with the currently effective time zone configuration to generate the local time. The atomic time zone switching mechanism ensures that the UTC hardware timestamps of all frames of images in the same scanning task are continuous, and the time zone rules used for conversion to local time are unified after the switching point, completely avoiding the problem of image sequence time logic disorder caused by time zone switching.
[0048] Example 3: Specific Application Case Based on the above core implementation method, the present invention provides two specific application methods, which are adapted to embedded slide scanners with different resource configurations. Both embodiments can achieve uninterrupted time zone switching and real-time verification of core scanning services, with only the technical implementation details adapted according to hardware resources.
[0049] Application 1: Lightweight implementation based on environment variables and function hooks This application is suitable for resource-constrained embedded operating environments, specifically Linux-based LTAC machine platforms. The scanner control software is developed in C++, and the specific execution steps are as follows: 1. Deploy time zone management middleware: Create a singleton class time zone management middleware as the core middleware. This manager maintains the currently effective time zone identifier and saves pointers to wrapper functions related to time zones in the C language library. It runs as a resident service module in the control software layer. 2. Receiving time zone switching requests: The time zone management middleware listens for JSON-formatted time zone switching requests sent by the configuration management service in real time through a local domain socket, and parses the target time zone configuration information in the request; 3. Construct a lightweight temporary timezone environment: In the verification thread, the target timezone TZ environment variable is configured locally by using the setenv function, and the tzset() function is called to load the new configuration into the timezone library of this thread. This temporary environment only applies to the verification thread and is completely isolated from the main business thread. 4. Perform parallel verification: Obtain the current Coordinated Universal Time (UTC) through a time function, and call the wrapper function (based on the current time zone) and the local time conversion function in the temporary environment to perform time conversion. Compare the time zone offset and time zone name of the two conversion results to see if they meet expectations. At the same time, call the test-specific file naming utility function to check whether the timestamp part of the simulated file name matches the expected timestamp calculated based on the new time zone and the current UTC. The verification process adopts the aforementioned I / O isolation mechanism to avoid polluting real business data. 5. Perform atomic time zone switching: If the verification passes, the time zone management middleware acquires the global lock and atomically completes two operations: updating the current time zone identifier in the internal storage to the target time zone and switching the implementation of the wrapper function to point to a new function that forces the conversion using the new time zone identifier; after the operation is completed, the global lock is released immediately, and thereafter all modules that obtain the time through the wrapper function will directly call the time information of the new time zone; 6. Clean up the temporary environment: If the verification thread exits normally, the temporarily created TZ environment variables and related configurations are automatically destroyed, releasing system resources; if the verification fails, the switching process is immediately stopped, the reason for the failure is reported back to the request source, the original time zone configuration is maintained, and the core scanning business is uninterrupted throughout the process.
[0050] Application 2: Enhanced Implementation Combining Containerization Technology This application is suitable for next-generation intelligent embedded slide scanners with more abundant computing resources. The scanner control software adopts a microservice architecture, with some services running in lightweight containers. The specific execution steps are as follows: 1. Deploy an independent time zone management middleware: Deploy the time zone management middleware as an independent time zone coordination service, which serves as the core microservice of the scanner control software. It is responsible for managing the global time zone configuration of the device and communicates with other microservices through a network interface. 2. Receiving Time Zone Switching Requests: The Time Zone Coordination Service receives time zone switching requests from users or device management systems through a Representational State Passing Application Programming Interface (REST API), parses and extracts the target time zone configuration information; 3. Construct a distributed temporary time zone environment: The time zone coordination service sends a verification notification to all business services that need to be aware of the time zone. The business services include at least the scanning service, the log service, and the task scheduling service. After receiving the notification, each business service creates a time zone verification sandbox locally. The sandbox is a mini container containing the new time zone configuration or an independent process space loaded with the new time zone database. Each sandbox is completely isolated from the actual running environment of the business service. 4. Perform distributed parallel verification: The time zone coordination service distributes predefined verification suites to each business service. These suites contain two types of test cases: system calls and business logic tests. Each business service runs the verification suites simultaneously in its local sandbox. After completing system interface verification, business logic sampling verification, and state consistency checks, the verification results are aggregated to the time zone coordination service through the message bus. 5. Perform atomic time zone switching: When the time zone coordination service receives successful verification feedback from all business services, it broadcasts a "switching effective" event with a synchronization token via the message bus; after receiving the event, each business service switches its runtime configuration to the new time zone at the same logical time point indicated by the synchronization token, and synchronously refreshes its local time zone cache data. 6. Complete the switchover process: After each business service completes the time zone switch, it reports the switchover success status to the time zone coordination service. After receiving the reports from all business services, the time zone coordination service sends the switchover success result back to the request source and notifies each business service to destroy its local time zone verification sandbox and release system resources. If the verification result of any business service fails, the time zone coordination service immediately stops the switchover process, notifies all business services to clean up the sandbox, maintains the original time zone configuration of the device, and ensures that the core scanning business is uninterrupted throughout the process.
[0051] The above embodiments of the present invention can be flexibly selected according to the actual application scenario and hardware resource configuration of the embedded slide scanner, and the technical features of each embodiment can be combined with each other without conflict to achieve better time zone switching and verification effects.
[0052] Example 4 This embodiment also provides an embedded slide scanner, see reference. Figure 5 It includes a memory 404 and a processor 402, wherein the memory 404 stores a computer program and the processor 402 is configured to run the computer program to perform the steps in any of the above method embodiments.
[0053] Specifically, the processor 402 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement embodiments of the present invention.
[0054] Memory 404 may include a mass storage device for data or instructions. For example, and not limitingly, memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 404 may include removable or non-removable (or fixed) media. Where appropriate, memory 404 may be internal or external to a data processing device. In a particular embodiment, memory 404 is non-volatile memory. In a particular embodiment, memory 404 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more of these. Where appropriate, the RAM can be Static Random-Access Memory (SRAM) or Dynamic Random-Access Memory (DRAM). DRAM can be Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), Extended Data Out Dynamic Random-Access Memory (EDODRAM), Synchronous Dynamic Random-Access Memory (SDRAM), etc.
[0055] The memory 404 can be used to store or cache various data files that need to be processed and / or communicated, as well as possible computer program instructions executed by the processor 402.
[0056] The processor 402 reads and executes computer program instructions stored in the memory 404 to implement any of the time zone lossless switching and real-time verification methods in the above embodiments.
[0057] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408, wherein the transmission device 406 is connected to the processor 402, and the input / output device 408 is connected to the processor 402.
[0058] The transmission device 406 can be used to receive or send data via a network. Specific examples of the network described above may include wired or wireless networks provided by the communication provider of the electronic device. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 406 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0059] Input / output device 408 is used to input or output information.
[0060] Example 5 This embodiment also provides a readable storage medium storing a computer program, the computer program including program code for controlling a process to execute the process, the process including the time zone lossless switching and real-time verification method according to Embodiment 2.
[0061] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0062] Generally, various embodiments can be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention can be implemented in hardware, while others can be implemented by firmware or software executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flowcharts, or using some other graphical representation, it should be understood that, by way of non-limiting example, these blocks, apparatuses, systems, techniques, or methods described herein can be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.
[0063] Embodiments of the present invention can be implemented by computer software, which may be executable by a data processor of a mobile device, such as a processor entity, or by hardware, or by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets, and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product may include one or more computer-executable components configured to perform the embodiments when the program is run. The one or more computer-executable components may be at least one piece of software code or a portion thereof. Additionally, it should be noted in this respect that, as Figure 2 Any box in the logical flow can represent a program step, or interconnected logic circuits, boxes and functions, or a combination of program steps and logic circuits, boxes and functions. Software can be stored on physical media such as memory chips or blocks of storage implemented within a processor, magnetic media such as hard disks or floppy disks, and optical media such as DVDs and their data variants, CDs, etc. The physical medium is a non-transient medium.
[0064] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0065] The above embodiments are merely illustrative of several implementations of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the appended claims.
Claims
1. A method for time zone lossless handover and real-time verification, characterized in that, For use in an embedded slide scanner, the following steps are included: Receive a request to switch to the target time zone; Without interrupting the continuous operation of the core business of the embedded slide scanner, a temporary time zone environment isolated from the current operating environment is constructed, and the target time zone configuration is simulated and loaded in the temporary time zone environment; Start a parallel verification thread to perform parallel verification of time-related interfaces and business logic within the software based on the temporary time zone environment; The determination is made based on the verification results: if all verification items pass, an atomic time zone switching operation is performed, so that the software's operating environment globally and synchronously perceives the target time zone configuration; if the verification fails, the switching process is aborted and the original time zone configuration is maintained.
2. The time zone lossless switching and real-time verification method as described in claim 1, characterized in that, Construct a temporary timezone environment isolated from the current operating environment, including: By configuring a thread-local target timezone environment variable and calling the timezone setting function, a temporary environment that applies only to the verification thread can be constructed; or, Create an independent temporary time zone environment context in memory, or build an independent temporary configuration directory in local storage, and load the configuration file of the target time zone to achieve data and input / output isolation from the current backbone business operating environment.
3. The time zone lossless switching and real-time verification method as described in claim 1, characterized in that, Parallel verification of time-related interfaces and business logic within the software is performed, including the following verification steps: System interface verification: In the temporary time zone environment, call the standard library functions related to time conversion, and compare the function execution results with the expected results calculated based on the current time zone and Coordinated Universal Time; Business logic sampling verification: Call the key business function interface of the scanning control software to check whether the time-related output generated in the temporary time zone environment conforms to the preset time logic rules; State consistency check: Check the software's internal time-related global state variables or cached data to verify that their timestamp data is stored in a unified Coordinated Universal Time (UTC) standard.
4. The time zone lossless switching and real-time verification method as described in claim 3, characterized in that, The specific content of business logic sampling verification should include at least one of the following: Intercept the function return data of the simulated scanned image file name and compare the timestamp part to see if it matches the expectation; Verify the accuracy of the calculated trigger time for the next scheduled scan task; The generated standard format log entries are output to an isolated memory buffer and their time recording compliance is verified.
5. The time zone lossless switching and real-time verification method as described in claim 1, characterized in that, Performing atomic time zone switching operations specifically includes: Acquire a global lock to protect the global shared timezone context, blocking other business threads from adding time read requests; Within the critical section after acquiring the global lock, the global shared time zone context is updated to the target time zone configuration through a single indivisible operation, or the global atomic pointer is replaced with a new pointer pointing to the target time zone configuration; Release the global lock and send a synchronization notification to cause all modules to automatically reload the target time zone configuration on the next time call.
6. The time zone lossless switching and real-time verification method as described in claim 1, characterized in that, Another way to implement atomic time zone switching operations is as follows: Maintain a version number mechanism for the time zone configuration and generate the latest version number bound to the target time zone configuration; or, The message bus broadcasts a switching activation event with a synchronization token to each business module, enabling each business module to atomically switch its runtime configuration to the target time zone at the same logical point in time after receiving the event.
7. A time zone non-destructive switching and real-time verification system for an embedded slide scanner, characterized in that, This includes a time zone management middleware deployed as a resident service module, specifically comprising: The request receiving module is used to listen for and receive requests to switch to the target time zone; The environment simulation module is used to construct a temporary time zone environment isolated from the current operating environment without interrupting the operation of core business, and to load the target time zone configuration into it; The verification engine module is used to start parallel verification threads to perform parallel verification of software time-related interfaces and business logic based on the temporary time zone environment. The atomic switching execution module is used to synchronize the target time zone configuration to the entire software runtime environment in an atomic manner when all verification items pass; and to abort the switching process when verification fails, so as to keep the core scanning task of the embedded slide scanner running continuously.
8. The system as described in claim 7, characterized in that, It also includes a scanning software business module that is monitored and scheduled by the time zone management middleware; The scanning software business module includes at least an optical imaging control module, a log module, and a task scheduling module; all hardware driver layers and business layers within the scanning software business module obtain timestamps based on the currently effective time zone configuration through the unified time service interface provided by the time zone management middleware.
9. An embedded slide scanner, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the time zone lossless switching and real-time verification method as described in any one of claims 1 to 6.
10. A readable storage medium, characterized in that, The readable storage medium stores a computer program, the computer program including program code for controlling the process to execute the process, the process including the time zone lossless switching and real-time verification method according to any one of claims 1 to 6.
