Commit 70ad251f77de81cebc29979e4fb7d1847f6b89a4
1 parent
a1115f22
Exists in
master
Movendo timer para funcoes da estrutura de controle de sessao
Showing
2 changed files
with
39 additions
and
24 deletions
Show diff stats
latest/src/include/lib3270/api.h
... | ... | @@ -274,6 +274,7 @@ |
274 | 274 | void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr); |
275 | 275 | void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col); |
276 | 276 | void (*set_oia)(H3270 *session, OIA_FLAG id, unsigned char on); |
277 | + void (*set_timer)(H3270 *session, unsigned char on); | |
277 | 278 | void (*update_luname)(H3270 *session, const char *name); |
278 | 279 | void (*update_status)(H3270 *session, LIB3270_STATUS id); |
279 | 280 | ... | ... |
latest/src/lib/ctlr.c
... | ... | @@ -2770,39 +2770,53 @@ void ticking_start(H3270 *session, Boolean anyway) |
2770 | 2770 | { |
2771 | 2771 | CHECK_SESSION_HANDLE(session); |
2772 | 2772 | |
2773 | - (void) gettimeofday(&t_start, (struct timezone *) 0); | |
2774 | - | |
2775 | - mticking = True; | |
2773 | + if(session->set_timer) | |
2774 | + { | |
2775 | + if(toggled(SHOW_TIMING) || anyway) | |
2776 | + session->set_timer(session,-1); | |
2777 | + } | |
2778 | + else | |
2779 | + { | |
2780 | + (void) gettimeofday(&t_start, (struct timezone *) 0); | |
2781 | + | |
2782 | + mticking = True; | |
2783 | + | |
2784 | + if (!toggled(SHOW_TIMING) && !anyway) | |
2785 | + return; | |
2786 | + status_untiming(session); | |
2787 | + if (ticking) | |
2788 | + RemoveTimeOut(tick_id); | |
2789 | + ticking = True; | |
2790 | + tick_id = AddTimeOut(1000, session, keep_ticking); | |
2791 | + t_want = t_start; | |
2792 | + } | |
2776 | 2793 | |
2777 | - if (!toggled(SHOW_TIMING) && !anyway) | |
2778 | - return; | |
2779 | - status_untiming(session); | |
2780 | - if (ticking) | |
2781 | - RemoveTimeOut(tick_id); | |
2782 | - ticking = True; | |
2783 | - tick_id = AddTimeOut(1000, session, keep_ticking); | |
2784 | - t_want = t_start; | |
2785 | 2794 | } |
2786 | 2795 | |
2787 | 2796 | static void ticking_stop(H3270 *session) |
2788 | 2797 | { |
2789 | - struct timeval t1; | |
2790 | - | |
2791 | 2798 | CHECK_SESSION_HANDLE(session); |
2792 | 2799 | |
2793 | - (void) gettimeofday(&t1, (struct timezone *) 0); | |
2794 | - if (mticking) { | |
2795 | -// sms_accumulate_time(&t_start, &t1); | |
2796 | - mticking = False; | |
2797 | - } else { | |
2798 | - return; | |
2800 | + if(session->set_timer) | |
2801 | + { | |
2802 | + session->set_timer(session,0); | |
2799 | 2803 | } |
2804 | + else | |
2805 | + { | |
2806 | + struct timeval t1; | |
2800 | 2807 | |
2801 | - if (!ticking) | |
2802 | - return; | |
2803 | - RemoveTimeOut(tick_id); | |
2804 | - ticking = False; | |
2805 | - status_timing(session,&t_start, &t1); | |
2808 | + (void) gettimeofday(&t1, (struct timezone *) 0); | |
2809 | + if (mticking) | |
2810 | + mticking = False; | |
2811 | + else | |
2812 | + return; | |
2813 | + | |
2814 | + if (!ticking) | |
2815 | + return; | |
2816 | + RemoveTimeOut(tick_id); | |
2817 | + ticking = False; | |
2818 | + status_timing(session,&t_start, &t1); | |
2819 | + } | |
2806 | 2820 | } |
2807 | 2821 | |
2808 | 2822 | void | ... | ... |